dependency-cruiser 18 cannot parse TypeScript 7, so it cruised no module, passed, and its report and the docs claimed it checked the layers. The import graph is the only checker; .dependency-cruiser.json stays as its rule file (D-11). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
69 lines
1.8 KiB
TypeScript
69 lines
1.8 KiB
TypeScript
import { readFile } from "node:fs/promises";
|
|
|
|
import { describe, expect, it } from "vitest";
|
|
|
|
import { architectureDependencyReportArtifactSchema } from "../../scripts/contracts/release-artifacts.ts";
|
|
|
|
// 12-05 (D-11). dependency-cruiser cannot parse TypeScript 7, so it checked
|
|
// zero modules and passed while its report claimed a result. The import graph
|
|
// in check-architecture.ts is the only checker; the report carries only it.
|
|
const staticImportGraph = {
|
|
analyzer: "babel-parser-node-resolver",
|
|
modules: [],
|
|
dependencies: [],
|
|
unresolved: [],
|
|
parseFailures: [],
|
|
cycles: [],
|
|
violations: [],
|
|
summary: {
|
|
modules: 0,
|
|
typescriptModules: 0,
|
|
dependencies: 0,
|
|
localDependencies: 0,
|
|
unresolved: 0,
|
|
parseFailures: 0,
|
|
cycles: 0,
|
|
errors: 0,
|
|
typeScriptOnlyPolicyPassed: true,
|
|
nonTypeScriptExecutableSources: 0,
|
|
},
|
|
fixtureChecks: { passed: true, checks: [], failures: [] },
|
|
typeScriptOnlySourcePolicy: {
|
|
checkedRoots: ["src"],
|
|
exceptionsAllowed: false,
|
|
violations: [],
|
|
passed: true,
|
|
},
|
|
};
|
|
|
|
describe("architecture dependency report", () => {
|
|
it("carries the import graph only", () => {
|
|
expect(architectureDependencyReportArtifactSchema.parse({ staticImportGraph })).toEqual({
|
|
staticImportGraph,
|
|
});
|
|
});
|
|
|
|
it("rejects a dependency-cruiser section", () => {
|
|
const cruiserSummary = {
|
|
violations: [],
|
|
error: 0,
|
|
warn: 0,
|
|
info: 0,
|
|
ignore: 0,
|
|
totalCruised: 0,
|
|
totalDependenciesCruised: 0,
|
|
};
|
|
expect(
|
|
architectureDependencyReportArtifactSchema.safeParse({
|
|
modules: [],
|
|
summary: cruiserSummary,
|
|
staticImportGraph,
|
|
}).success,
|
|
).toBe(false);
|
|
});
|
|
|
|
it("does not run dependency-cruiser", async () => {
|
|
expect(await readFile("scripts/check-architecture.ts", "utf8")).not.toMatch(/depcruise/u);
|
|
});
|
|
});
|