perf(tests): consolidate TypeScript dialect producer checks
This commit is contained in:
parent
29ff887f65
commit
01762b10c6
|
|
@ -6,33 +6,33 @@ import {
|
|||
typeScriptDialectCases,
|
||||
createTypeScriptDialectArtifact,
|
||||
expectTypeScriptDialectReference,
|
||||
expectValidTypeScriptInput,
|
||||
} from "../../fixtures/javascriptArtifactTypeScriptDialect.js";
|
||||
import { cliTest } from "../../support/cli/cliFixture.js";
|
||||
|
||||
for (const format of ["directory", "asar"] as const) {
|
||||
for (const command of ["analyze-javascript-application", "analyze"]) {
|
||||
cliTest(
|
||||
`${command} retains TypeScript dialect reference facts for ${format}`,
|
||||
async ({ cli }) => {
|
||||
for (const fixture of typeScriptDialectCases)
|
||||
await expectValidTypeScriptInput(fixture.path, fixture.source);
|
||||
const input = await createTypeScriptDialectArtifact(
|
||||
format,
|
||||
typeScriptDialectCases,
|
||||
);
|
||||
const output = await cli.run({ arguments: [command, input, "--json"] });
|
||||
expect(output.exitCode).toBe(0);
|
||||
const result = javascriptApplicationAnalysisResultSchema.parse(
|
||||
parseEvidence(output.json).normalized_result,
|
||||
);
|
||||
expect(result.statistics).toMatchObject({
|
||||
parse_failures: 0,
|
||||
invalid_utf8_files: 0,
|
||||
});
|
||||
for (const fixture of typeScriptDialectCases)
|
||||
expectTypeScriptDialectReference(result.graph, fixture);
|
||||
},
|
||||
);
|
||||
}
|
||||
// These complementary rows cover both CLI adapters and carrier formats; both
|
||||
// adapters enter the same JavaScript application workflow.
|
||||
for (const { command, format } of [
|
||||
{ command: "analyze-javascript-application", format: "asar" },
|
||||
{ command: "analyze", format: "directory" },
|
||||
] as const) {
|
||||
cliTest(
|
||||
`${command} retains TypeScript dialect reference facts for ${format}`,
|
||||
async ({ cli }) => {
|
||||
const input = await createTypeScriptDialectArtifact(
|
||||
format,
|
||||
typeScriptDialectCases,
|
||||
);
|
||||
const output = await cli.run({ arguments: [command, input, "--json"] });
|
||||
expect(output.exitCode).toBe(0);
|
||||
const result = javascriptApplicationAnalysisResultSchema.parse(
|
||||
parseEvidence(output.json).normalized_result,
|
||||
);
|
||||
expect(result.statistics).toMatchObject({
|
||||
parse_failures: 0,
|
||||
invalid_utf8_files: 0,
|
||||
});
|
||||
for (const fixture of typeScriptDialectCases)
|
||||
expectTypeScriptDialectReference(result.graph, fixture);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,10 +9,15 @@ import {
|
|||
expectValidTypeScriptInput,
|
||||
} from "../../fixtures/javascriptArtifactTypeScriptDialect.js";
|
||||
|
||||
for (const fixture of typeScriptDialectCases) {
|
||||
it(`validates ${fixture.path} with the locked TypeScript producer`, async () => {
|
||||
await expectValidTypeScriptInput(fixture.path, fixture.source);
|
||||
});
|
||||
}
|
||||
|
||||
for (const format of ["directory", "asar"] as const) {
|
||||
for (const fixture of typeScriptDialectCases) {
|
||||
it(`${format} retains ${fixture.path} syntax-derived reference facts`, async () => {
|
||||
await expectValidTypeScriptInput(fixture.path, fixture.source);
|
||||
const input = await createTypeScriptDialectArtifact(format, [fixture]);
|
||||
const result = await reconstructJavaScriptArtifact({ input_path: input });
|
||||
expect(result.statistics).toMatchObject({
|
||||
|
|
|
|||
Loading…
Reference in New Issue