fix(javascript): retain NodeNext artifact source facts (#1087)
* test(javascript): reproduce omitted NodeNext artifact sources Tests only: qualify current .mts/.cts artifact selection through real directory and ASAR reconstruction and the built public CLI. Signed-off-by: Rudy Celekli <rudy@gradiahq.com> * fix(javascript): retain NodeNext artifact source facts Read .mts and .cts artifact files through the existing inert TypeScript parser, preserving selected file identities and analysis facts in directory and ASAR inputs. Document source selection and format the existing regression assertion. Signed-off-by: Rudy Celekli <rudy@gradiahq.com> --------- Signed-off-by: Rudy Celekli <rudy@gradiahq.com> Co-authored-by: N0zoM1z0 <1705004398@qq.com>
This commit is contained in:
co-authored by
N0zoM1z0
parent
5a67c7fc54
commit
c1b370ce0d
@@ -72,6 +72,40 @@ cliTest(
|
||||
},
|
||||
);
|
||||
|
||||
for (const extension of ["mts", "cts"]) {
|
||||
for (const command of ["analyze-javascript-application", "analyze"]) {
|
||||
cliTest(
|
||||
`${command} returns facts for a selected ${extension} source`,
|
||||
async ({ cli }) => {
|
||||
const root = await createTestTempDirectory("rea-nodenext-cli-");
|
||||
const path = `selected.${extension}`;
|
||||
await writeFile(
|
||||
join(root, path),
|
||||
"export function selected_feature(value: string) { return { value }; }",
|
||||
);
|
||||
const output = await cli.run({ arguments: [command, root, "--json"] });
|
||||
expect(output.exitCode).toBe(0);
|
||||
const evidence = parseEvidence(output.json);
|
||||
const result = javascriptApplicationAnalysisResultSchema.parse(
|
||||
evidence.normalized_result,
|
||||
);
|
||||
expect(result.statistics).toMatchObject({
|
||||
relevant_files: 1,
|
||||
parsed_javascript_files: 1,
|
||||
parse_failures: 0,
|
||||
});
|
||||
expect(
|
||||
result.graph.nodes.some(
|
||||
({ kind, observations }) =>
|
||||
kind === "javascript-asset" &&
|
||||
observations.some(({ properties }) => properties.path === path),
|
||||
),
|
||||
).toBe(true);
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
for (const command of ["analyze-javascript-application", "analyze"]) {
|
||||
cliTest(
|
||||
`${command} retains HTML source ranges after a bare carriage return`,
|
||||
|
||||
Reference in New Issue
Block a user