diff --git a/tests/architecture/dependency-rules.test.ts b/tests/architecture/dependency-rules.test.ts index cb0a494..3a36fa3 100644 --- a/tests/architecture/dependency-rules.test.ts +++ b/tests/architecture/dependency-rules.test.ts @@ -4,19 +4,22 @@ import { describe, expect, it } from "vitest"; const root = fileURLToPath(new URL("../..", import.meta.url)); const fixture = fileURLToPath(new URL("../fixtures/depcruise", import.meta.url)); -const bin = `${root}node_modules/.bin/depcruise`; +// Node runs the package's own entry: `node_modules/.bin/depcruise` is a POSIX shell shim that Windows +// cannot spawn without a shell (ENOENT, #78). +const bin = `${root}node_modules/dependency-cruiser/bin/dependency-cruiser.mjs`; // Runs the real dependency-cruiser with the project's config against a fixture tree that // contains one deliberate deep import across modules. function cruise(entry: string) { - const result = spawnSync(bin, [entry, "--config", `${root}.dependency-cruiser.cjs`, "--no-progress", "--output-type", "err"], { + const result = spawnSync(process.execPath, [bin, entry, "--config", `${root}.dependency-cruiser.cjs`, "--no-progress", "--output-type", "err"], { cwd: fixture, encoding: "utf8", }); return { status: result.status, output: `${result.stdout}${result.stderr}` }; } -describe("module boundary rules", () => { +// Each case starts a real dependency-cruiser run: up to ~5 s on Windows (#87 review), ~1 s on Linux CI. +describe("module boundary rules", { timeout: 20_000 }, () => { it("rejects a deep import into another module's internals", () => { const { status, output } = cruise("src/features/alpha");