test(features): link fixture node_modules through the shared helper (09-01, 09-02)
check:adapter-inventory allows only linkFixtureNodeModules for fixture dependencies; a single directory symlink lets a pnpm purge in the fixture reach the repository's own node_modules. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
070d4dbe9c
commit
2a1591a2fe
@@ -1,11 +1,12 @@
|
||||
import { spawnSync } from "node:child_process";
|
||||
import { cp, mkdir, mkdtemp, readFile, rm, symlink } from "node:fs/promises";
|
||||
import { cp, mkdir, mkdtemp, readFile, rm } from "node:fs/promises";
|
||||
import { tmpdir } from "node:os";
|
||||
import path from "node:path";
|
||||
import { pathToFileURL } from "node:url";
|
||||
|
||||
import { afterAll, describe, expect, it } from "vitest";
|
||||
|
||||
import { linkFixtureNodeModules } from "../../scripts/lib/fixture-node-modules.ts";
|
||||
import { filesBelow } from "../../scripts/lib/removal-fixture.ts";
|
||||
import { ROUTE_FEATURE_OWNER } from "../../src/features/installed-feature-contracts.ts";
|
||||
import { COMPILED_PRODUCT_FEATURE_IDS } from "../../src/features/installed-product-manifest.ts";
|
||||
@@ -47,7 +48,7 @@ describe("VITE_PRODUCT_FEATURES=none build (09-02)", () => {
|
||||
await mkdir(path.dirname(path.join(root, input)), { recursive: true });
|
||||
await cp(path.resolve(input), path.join(root, input), { recursive: true });
|
||||
}
|
||||
await symlink(path.resolve("node_modules"), path.join(root, "node_modules"), "dir");
|
||||
await linkFixtureNodeModules(root);
|
||||
const env = { ...process.env, VITE_PRODUCT_FEATURES: "none" };
|
||||
|
||||
const generated = spawnSync(
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
import { spawnSync } from "node:child_process";
|
||||
import { cp, mkdir, mkdtemp, readFile, rm, symlink, writeFile } from "node:fs/promises";
|
||||
import { cp, mkdir, mkdtemp, readFile, rm, writeFile } from "node:fs/promises";
|
||||
import { tmpdir } from "node:os";
|
||||
import path from "node:path";
|
||||
|
||||
import { afterAll, describe, expect, it } from "vitest";
|
||||
|
||||
import { linkFixtureNodeModules } from "../../scripts/lib/fixture-node-modules.ts";
|
||||
|
||||
/**
|
||||
* 09-01. The central composers (`src/features/installed-*`) are typed from the
|
||||
* generated feature index, so the repository's own typecheck only ever sees
|
||||
@@ -144,7 +146,7 @@ describe("installing a second feature (09-01)", () => {
|
||||
for (const config of ["tsconfig.base.json", "tsconfig.app.json"]) {
|
||||
await cp(path.resolve(config), path.join(root, config));
|
||||
}
|
||||
await symlink(path.resolve("node_modules"), path.join(root, "node_modules"), "dir");
|
||||
await linkFixtureNodeModules(root);
|
||||
const files: Readonly<Record<string, string>> = {
|
||||
"src/contexts/two-feature-context/context-module.ts": CONTEXT_MODULE,
|
||||
"src/features/routed-feature/feature-module.ts": ROUTED_FEATURE_MODULE,
|
||||
|
||||
Reference in New Issue
Block a user