test(vsix): share the inspection report fixture (#15729)

This commit is contained in:
Vincent Koc authored and GitHub committed 2026-12-02 01:55:33 +00:00
1 parent cacaefe8f8
commit b0a6081ef2
3 files changed
+100 -145

No files matched your search

@@ -1,8 +1,8 @@
import { vsixInspectionReport } from "../../../tests/fixtures/vsixInspectionReport.js";
import { expectInvalidInspectionInputs } from "../../../tests/support/expectInvalidInspectionInputs.js";
import { lateCancellationEvidence } from "../../../tests/support/lateCancellationEvidence.js";
import { expect, it } from "vitest";
import { VsixPackageService } from "./VsixPackageService.js";
import type { VsixPackage } from "../../domain/vsix/vsixPackage.js";
import { ok } from "../../domain/result.js";
import { AnalysisOutputError } from "../../domain/analysisErrorCore.js";
@@ -12,7 +12,7 @@ const identity = {
version: "1",
};
const report: VsixPackage = {
const report = vsixInspectionReport({
artifact: {
path: "/artifacts/demo.vsix",
sha256: "a".repeat(64),
@@ -26,32 +26,11 @@ const report: VsixPackage = {
display_name: "Hello Demo",
description: "A tiny fixture extension.",
},
package_identity: {
name: "hello",
publisher: "demo",
version: "1.2.3",
},
identity_disagreements: [],
engine: {
vsixmanifest: "^1.74.0",
package_json: "^1.74.0",
disagreement: false,
},
target_platform: "win32-x64",
entry_points: {
main: { path: "extension/out/extension.js", present: true },
browser: { path: "extension/out/web/extension.js", present: true },
},
activation_events: [
{ event: "onCommand:demo.hello", eager: false },
{ event: "*", eager: true },
],
contributes: {
keys: [{ name: "commands", count: 1 }],
commands: [{ command: "demo.hello", title: "Say Hello" }],
commands_total: 1,
commands_omitted: 0,
},
extension_dependencies: {
vsixmanifest: ["other.dep"],
package_json: ["other.dep"],
@@ -68,42 +47,12 @@ const report: VsixPackage = {
virtual_workspaces: null,
},
enabled_api_proposals: ["testObserver"],
assets: [],
signatures: { p7s: false, manifest: false },
contents: [
{
name: "extension.vsixmanifest",
path: "extension.vsixmanifest",
uncompressed_size: 12,
compressed_size: 12,
encrypted: false,
kind: "vsixmanifest",
traverses: false,
},
],
member_kind_counts: {
vsixmanifest: 1,
package_json: 0,
content_types: 0,
opc: 0,
signature: 0,
javascript: 0,
native_addon: 0,
wasm: 0,
executable: 0,
shell_script: 0,
nested_archive: 0,
unknown: 0,
},
interesting_members: [],
duplicate_paths: [],
vsixmanifest: { path: "extension.vsixmanifest", bytes: 12 },
package_json: null,
coverage: { status: "complete", entries: 1, examined_manifest_bytes: 12 },
limitations: [
"This workflow reads the .vsix ZIP, extension.vsixmanifest and extension/package.json without installing, executing, or contacting a marketplace.",
],
};
});
it("rejects relative paths, extra arguments, and NUL paths before reading", async () => {
await expectInvalidInspectionInputs(
@@ -1,101 +1,12 @@
import { vsixInspectionReport } from "../../../tests/fixtures/vsixInspectionReport.js";
import { expect, it } from "vitest";
import type { VsixPackage } from "../vsix/vsixPackage.js";
import { createEvidence } from "../evidence.js";
import { projectAnalysisView } from "./analysisView.js";
import type { AnalysisViewParent } from "./analysisViewParent.js";
import { vsixPackageSummaryViewResultSchema } from "./analysisViewResult.js";
import { analysisViewRequestSchema } from "./analysisViewRequest.js";
const report: VsixPackage = {
artifact: {
path: "/artifacts/demo.vsix",
sha256: "a".repeat(64),
bytes: 100,
},
vsix_identity: {
id: "demo.hello",
version: "1.2.3",
publisher: "demo",
target_platform: null,
display_name: "Hello Demo",
description: null,
},
package_identity: {
name: "hello",
publisher: "demo",
version: "1.2.3",
},
identity_disagreements: [],
engine: {
vsixmanifest: "^1.74.0",
package_json: "^1.74.0",
disagreement: false,
},
target_platform: null,
entry_points: {
main: { path: "extension/out/extension.js", present: true },
browser: null,
},
activation_events: [
{ event: "onCommand:demo.hello", eager: false },
{ event: "*", eager: true },
],
contributes: {
keys: [{ name: "commands", count: 1 }],
commands: [{ command: "demo.hello", title: "Say Hello" }],
commands_total: 1,
commands_omitted: 0,
},
extension_dependencies: {
vsixmanifest: [],
package_json: [],
disagreement: false,
},
extension_pack: {
vsixmanifest: [],
package_json: [],
disagreement: false,
},
extension_kind: [],
capabilities: {
untrusted_workspaces: null,
virtual_workspaces: null,
},
enabled_api_proposals: [],
assets: [],
signatures: { p7s: false, manifest: false },
contents: [
{
name: "extension.vsixmanifest",
path: "extension.vsixmanifest",
uncompressed_size: 12,
compressed_size: 12,
encrypted: false,
kind: "vsixmanifest",
traverses: false,
},
],
member_kind_counts: {
vsixmanifest: 1,
package_json: 0,
content_types: 0,
opc: 0,
signature: 0,
javascript: 0,
native_addon: 0,
wasm: 0,
executable: 0,
shell_script: 0,
nested_archive: 0,
unknown: 0,
},
interesting_members: [],
duplicate_paths: [],
vsixmanifest: { path: "extension.vsixmanifest", bytes: 12 },
package_json: { path: "extension/package.json", bytes: 20 },
coverage: { status: "complete", entries: 1, examined_manifest_bytes: 32 },
limitations: ["Package condition"],
};
const report = vsixInspectionReport();
const parent = (override: typeof report = report): AnalysisViewParent => {
const evidence = createEvidence(
+95
View File
@@ -0,0 +1,95 @@
import type { VsixPackage } from "../../src/domain/vsix/vsixPackage.js";
export const vsixInspectionReport = (
overrides: Partial<VsixPackage> = {},
): VsixPackage => ({
artifact: {
path: "/artifacts/demo.vsix",
sha256: "a".repeat(64),
bytes: 100,
},
vsix_identity: {
id: "demo.hello",
version: "1.2.3",
publisher: "demo",
target_platform: null,
display_name: "Hello Demo",
description: null,
},
package_identity: {
name: "hello",
publisher: "demo",
version: "1.2.3",
},
identity_disagreements: [],
engine: {
vsixmanifest: "^1.74.0",
package_json: "^1.74.0",
disagreement: false,
},
target_platform: null,
entry_points: {
main: { path: "extension/out/extension.js", present: true },
browser: null,
},
activation_events: [
{ event: "onCommand:demo.hello", eager: false },
{ event: "*", eager: true },
],
contributes: {
keys: [{ name: "commands", count: 1 }],
commands: [{ command: "demo.hello", title: "Say Hello" }],
commands_total: 1,
commands_omitted: 0,
},
extension_dependencies: {
vsixmanifest: [],
package_json: [],
disagreement: false,
},
extension_pack: {
vsixmanifest: [],
package_json: [],
disagreement: false,
},
extension_kind: [],
capabilities: {
untrusted_workspaces: null,
virtual_workspaces: null,
},
enabled_api_proposals: [],
assets: [],
signatures: { p7s: false, manifest: false },
contents: [
{
name: "extension.vsixmanifest",
path: "extension.vsixmanifest",
uncompressed_size: 12,
compressed_size: 12,
encrypted: false,
kind: "vsixmanifest",
traverses: false,
},
],
member_kind_counts: {
vsixmanifest: 1,
package_json: 0,
content_types: 0,
opc: 0,
signature: 0,
javascript: 0,
native_addon: 0,
wasm: 0,
executable: 0,
shell_script: 0,
nested_archive: 0,
unknown: 0,
},
interesting_members: [],
duplicate_paths: [],
vsixmanifest: { path: "extension.vsixmanifest", bytes: 12 },
package_json: { path: "extension/package.json", bytes: 20 },
coverage: { status: "complete", entries: 1, examined_manifest_bytes: 32 },
limitations: ["Package condition"],
...overrides,
});