mirror of
https://github.com/morluto/rea.git
synced 2026-11-11 01:13:39 +00:00
fix(javascript): preserve uncertainty for unexamined sources (#7911)
* fix(javascript): preserve uncertainty for unexamined sources * fix(javascript): compare observed package parsing status
This commit is contained in:
1 parent
95f0625781
commit
63f05d1cad
6 files changed
+379
-10
No files matched your search
@@ -480,3 +480,45 @@ it("attaches sender validation to the innermost handler after a long minified li
|
||||
),
|
||||
).toBe(true);
|
||||
});
|
||||
|
||||
it("projects package parse status from the package observation", () => {
|
||||
const file = {
|
||||
...skippedFile(),
|
||||
path: "package.json",
|
||||
kind: "package-json" as const,
|
||||
};
|
||||
const entry: AnalyzedJavaScriptArtifactFile = {
|
||||
file,
|
||||
javascript: null,
|
||||
semantic: null,
|
||||
};
|
||||
const analysis = {
|
||||
...analysisFor([entry]),
|
||||
packages: [
|
||||
{
|
||||
path: file.path,
|
||||
sha256: file.sha256,
|
||||
status: "included" as const,
|
||||
name: "fixture",
|
||||
version: null,
|
||||
main: null,
|
||||
main_status: "default" as const,
|
||||
main_entrypoint: "index.js",
|
||||
renderer_declarations: {},
|
||||
renderer_entrypoint: null,
|
||||
limitation: null,
|
||||
},
|
||||
],
|
||||
};
|
||||
const context = contextFor(file, analysis);
|
||||
addJavaScriptArtifactFiles(context);
|
||||
const observation = context.accumulator
|
||||
.nodes()
|
||||
.flatMap(({ observations }) => observations)
|
||||
.find(({ properties }) => properties.file_kind === "package-json");
|
||||
expect(observation?.properties).toMatchObject({
|
||||
file_kind: "package-json",
|
||||
package_parse_status: "included",
|
||||
json_parse_status: null,
|
||||
});
|
||||
});
|
||||
@@ -156,6 +156,7 @@ export const addJavaScriptArtifactFiles = (
|
||||
file,
|
||||
analyzed.javascript,
|
||||
jsonValue,
|
||||
packagesByPath.get(file.path),
|
||||
isSkippedJavaScriptAnalysis(analyzed),
|
||||
);
|
||||
if (
|
||||
@@ -632,6 +633,7 @@ const createFileTarget = (
|
||||
file: JavaScriptArtifactFile,
|
||||
javascript: JavaScriptArtifactAnalysis["files"][number]["javascript"],
|
||||
json: JavaScriptArtifactAnalysis["json_modules"][number] | undefined,
|
||||
packageValue: JavaScriptArtifactAnalysis["packages"][number] | undefined,
|
||||
skipped: boolean,
|
||||
): ApplicationNode => {
|
||||
const kind = artifactFileNodeKind(file.kind);
|
||||
@@ -671,6 +673,9 @@ const createFileTarget = (
|
||||
}
|
||||
: {}),
|
||||
json_parse_status: json?.status ?? null,
|
||||
...(file.kind === "package-json"
|
||||
? { package_parse_status: packageValue?.status ?? null }
|
||||
: {}),
|
||||
json_top_level_keys: json?.top_level_keys ?? [],
|
||||
omitted_json_top_level_keys:
|
||||
json === undefined
|
||||
|
||||
Reference in new issue
Block a user