-
-
Notifications
You must be signed in to change notification settings - Fork 16
Expand file tree
/
Copy pathcli-integration.test.ts
More file actions
638 lines (569 loc) · 21.5 KB
/
cli-integration.test.ts
File metadata and controls
638 lines (569 loc) · 21.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
import { jest } from "@jest/globals";
import { EventEmitter } from "node:events";
import { PassThrough } from "node:stream";
import type { Finding, PackageRef, ScanInput } from "../src/types.js";
import { stripAnsi } from "../src/utils/chalk.js";
const printBannerMock = jest.fn<any>();
const printHelpMock = jest.fn<any>();
const parseArgsMock = jest.fn<any>();
const loadPackagesMock = jest.fn<any>();
const buildNoPackagesMessageMock = jest.fn<any>();
const scanPackagesMock = jest.fn<any>();
const syncOsvAdvisoriesMock = jest.fn<any>();
const printCacheSummaryMock = jest.fn<any>();
const logInfoMock = jest.fn<any>();
const logWarnMock = jest.fn<any>();
const serializeFindingMock = jest.fn<any>();
const sortFindingsForOutputMock = jest.fn((findings: Finding[]) => findings);
const printSummaryMock = jest.fn<any>();
const printActionSummaryMock = jest.fn<any>();
const printPriorityFixesMock = jest.fn<any>();
const printFixPlanMock = jest.fn<any>();
const printSuggestedFixCommandsMock = jest.fn<any>();
const printSuggestedFixCommandSkipsMock = jest.fn<any>();
const printCoverageMock = jest.fn<any>();
const printSkippedDependenciesMock = jest.fn<any>();
const printGroupSummaryMock = jest.fn<any>();
const printTableMock = jest.fn<any>();
const printPathHintsMock = jest.fn<any>();
const printFinalStatusMock = jest.fn<any>();
const printCompactOutputMock = jest.fn<any>();
const buildSuggestedFixCommandPlanMock = jest.fn<any>();
const spawnMock = jest.fn<any>();
const buildReportDataMock = jest.fn<any>();
const writeHtmlReportMock = jest.fn<any>();
jest.unstable_mockModule("../src/cli/help.js", () => ({
printBanner: printBannerMock,
printHelp: printHelpMock,
}));
jest.unstable_mockModule("../src/cli/args.js", () => ({
parseArgs: parseArgsMock,
}));
jest.unstable_mockModule("../src/parsers/index.js", () => ({
loadPackages: loadPackagesMock,
buildNoPackagesMessage: buildNoPackagesMessageMock,
}));
jest.unstable_mockModule("../src/scanner.js", () => ({
scanPackages: scanPackagesMock,
buildCoverageNotes: jest.fn(() => ["Coverage note"]),
createAdvisorySource: jest.fn((options?: { osvUrl?: string; offline?: boolean; offlineDb?: string }) => ({
advisorySource: {
queryBatch: jest.fn(),
getVuln: jest.fn(),
},
offline: !!options?.offline || !!options?.offlineDb,
sourceLabel: options?.offline || options?.offlineDb
? `local advisory database (${options?.offlineDb ?? "/tmp/default-advisories.db"})`
: options?.osvUrl
? `custom OSV endpoint (${options.osvUrl})`
: "OSV (https://api.osv.dev)",
advisoryDbMetadata: options?.offline || options?.offlineDb
? { lastSyncAt: new Date(Date.now() - 2 * 60 * 60 * 1000).toISOString(), sourceUrl: "https://storage.googleapis.com/osv-vulnerabilities/npm/all.zip" }
: null,
advisoryDbIsStale: false,
cleanup: jest.fn(),
})),
}));
jest.unstable_mockModule("../src/advisory/osv-sync.js", () => ({
syncOsvAdvisories: syncOsvAdvisoriesMock,
}));
jest.unstable_mockModule("../src/output/formatters.js", () => ({
logInfo: logInfoMock,
logWarn: logWarnMock,
printCacheSummary: printCacheSummaryMock,
serializeFinding: serializeFindingMock,
sortFindingsForOutput: sortFindingsForOutputMock,
}));
jest.unstable_mockModule("../src/output/printers.js", () => ({
printSummary: printSummaryMock,
printActionSummary: printActionSummaryMock,
printPriorityFixes: printPriorityFixesMock,
printFixPlan: printFixPlanMock,
printSuggestedFixCommands: printSuggestedFixCommandsMock,
printSuggestedFixCommandSkips: printSuggestedFixCommandSkipsMock,
printCoverage: printCoverageMock,
printSkippedDependencies: printSkippedDependenciesMock,
printGroupSummary: printGroupSummaryMock,
printTable: printTableMock,
printPathHints: printPathHintsMock,
printFinalStatus: printFinalStatusMock,
printCompactOutput: printCompactOutputMock,
}));
jest.unstable_mockModule("../src/remediation/fix-commands.js", () => ({
buildSuggestedFixCommandPlan: buildSuggestedFixCommandPlanMock,
}));
jest.unstable_mockModule("node:child_process", () => ({
spawn: spawnMock,
}));
jest.unstable_mockModule("../src/output/html-reporter.js", () => ({
buildReportData: buildReportDataMock,
writeHtmlReport: writeHtmlReportMock,
}));
function createScanInput(overrides?: Partial<ScanInput>): ScanInput {
return {
mode: "manifest-fallback",
source: "package-json",
filePath: "/tmp/project/package.json",
packages: [],
notes: ["Parser note"],
warnings: [],
skippedDependencies: [],
...overrides,
};
}
function createFinding(overrides?: Partial<Finding>): Finding {
return {
pkg: {
name: "lodash",
version: "4.17.20",
ecosystem: "npm",
paths: [["project", "lodash"]],
},
vulnerabilities: [{ id: "OSV-123" }],
severity: "critical",
cveAliases: ["CVE-2026-0001"],
dependencyPaths: [["project", "lodash"]],
relationship: "direct",
firstFixedVersion: "4.17.21",
recommendedParentUpgrade: undefined,
...overrides,
};
}
async function runIndexModule() {
const exitSpy = jest
.spyOn(process, "exit")
.mockImplementation(((code?: number) => code as never) as never);
const logSpy = jest.spyOn(console, "log").mockImplementation(() => {});
const errorSpy = jest.spyOn(console, "error").mockImplementation(() => {});
try {
await import(`../src/index.ts?test=${Date.now()}-${Math.random()}`);
await new Promise(resolve => setTimeout(resolve, 0));
} finally {
}
const exitCalls = exitSpy.mock.calls.map(call => call[0]);
const stdout = logSpy.mock.calls.map(call => call.map(value => String(value)).join(" "));
const stderr = errorSpy.mock.calls.map(call => call.map(value => String(value)).join(" "));
exitSpy.mockRestore();
logSpy.mockRestore();
errorSpy.mockRestore();
if (exitCalls.length === 0) {
throw new Error("index.ts did not call process.exit");
}
return {
exitCode: Number(exitCalls[exitCalls.length - 1] ?? 0),
exitCalls,
stdout,
stderr,
};
}
describe("CLI integration", () => {
beforeEach(() => {
jest.clearAllMocks();
buildSuggestedFixCommandPlanMock.mockReturnValue(null);
spawnMock.mockImplementation(() => {
const child = new EventEmitter() as EventEmitter & { stdout: PassThrough; stderr: PassThrough };
child.stdout = new PassThrough();
child.stderr = new PassThrough();
setImmediate(() => child.emit("close", 0));
return child;
});
parseArgsMock.mockReturnValue({
command: "scan",
options: {
failOn: "critical",
batchSize: "100",
searchDepth: "4",
minSeverity: "medium",
},
projectArg: ".",
});
buildNoPackagesMessageMock.mockReturnValue("No scannable packages were found.");
loadPackagesMock.mockReturnValue(createScanInput());
scanPackagesMock.mockResolvedValue([]);
syncOsvAdvisoriesMock.mockResolvedValue({
advisoryCount: 0,
dbPath: "/tmp/advisories.db",
sourceUrl: "https://storage.googleapis.com/osv-vulnerabilities/npm/all.zip",
});
serializeFindingMock.mockImplementation((finding: Finding) => ({
package: finding.pkg.name,
severity: finding.severity,
}));
buildReportDataMock.mockReturnValue({ cliVersion: "1.8.0", findings: [] });
writeHtmlReportMock.mockResolvedValue({ reportPath: "/tmp/cve-report/index.html" });
});
it("returns a json payload and exits successfully when no findings are present", async () => {
const packages: PackageRef[] = [
{ name: "lodash", version: "4.17.21", ecosystem: "npm", paths: [["project", "lodash"]] },
];
parseArgsMock.mockReturnValue({
command: "scan",
options: {
json: true,
failOn: "critical",
batchSize: "100",
searchDepth: "4",
minSeverity: "medium",
},
projectArg: ".",
});
loadPackagesMock.mockReturnValue(createScanInput({ packages }));
const result = await runIndexModule();
expect(result.exitCode).toBe(0);
expect(stripAnsi(result.stdout[0] ?? "")).toContain("Advisory source: OSV");
expect(JSON.parse(result.stdout[result.stdout.length - 1] ?? "")).toMatchObject({
mode: "manifest-fallback",
source: "package-json",
packageCount: 1,
findingCount: 0,
findings: [],
});
});
it("prints the versioned banner and exits when --version is requested", async () => {
parseArgsMock.mockReturnValue({
command: "scan",
options: {
version: true,
failOn: "critical",
batchSize: "100",
searchDepth: "4",
minSeverity: "medium",
},
projectArg: ".",
});
const result = await runIndexModule();
expect(result.exitCode).toBe(0);
expect(printBannerMock).toHaveBeenCalled();
expect(loadPackagesMock).not.toHaveBeenCalled();
expect(scanPackagesMock).not.toHaveBeenCalled();
});
it("fails cleanly when argument parsing throws for an unknown option", async () => {
parseArgsMock.mockImplementation(() => {
throw new Error("Unknown option: --wat");
});
const result = await runIndexModule();
expect(result.exitCode).toBe(1);
expect(result.stderr.join("\n")).toContain("Error: Unknown option: --wat");
expect(result.stderr.join("\n")).toContain("Run `cve-lite --help` to see supported options.");
expect(printBannerMock).not.toHaveBeenCalled();
expect(loadPackagesMock).not.toHaveBeenCalled();
});
it("exits with a failure code when findings meet the fail-on threshold", async () => {
const finding = createFinding();
parseArgsMock.mockReturnValue({
command: "scan",
options: {
json: true,
failOn: "high",
batchSize: "100",
searchDepth: "4",
minSeverity: "medium",
},
projectArg: ".",
});
loadPackagesMock.mockReturnValue(createScanInput({ packages: [finding.pkg] }));
scanPackagesMock.mockResolvedValue([finding]);
const result = await runIndexModule();
expect(result.exitCode).toBe(1);
expect(stripAnsi(result.stdout[0] ?? "")).toContain("Advisory source: OSV");
expect(JSON.parse(result.stdout[result.stdout.length - 1] ?? "")).toMatchObject({
findingCount: 1,
findings: [{ package: "lodash", severity: "critical" }],
});
});
it("warns and exits cleanly when no scannable packages are found", async () => {
loadPackagesMock.mockReturnValue(createScanInput({ packages: [] }));
const result = await runIndexModule();
expect(result.exitCode).toBe(0);
expect(logWarnMock).toHaveBeenCalledWith("No scannable packages were found.", expect.anything());
});
it("fails fast for an invalid osv url", async () => {
parseArgsMock.mockReturnValue({
command: "scan",
options: {
failOn: "critical",
batchSize: "100",
searchDepth: "4",
minSeverity: "medium",
osvUrl: "not-a-url",
},
projectArg: ".",
});
const result = await runIndexModule();
expect(result.exitCode).toBe(1);
expect(result.stderr.join("\n")).toContain("Invalid value for --osv-url: not-a-url");
expect(loadPackagesMock).not.toHaveBeenCalled();
});
it("prints an offline advisory DB hint when OSV requests appear blocked", async () => {
loadPackagesMock.mockReturnValue(createScanInput({
packages: [{ name: "lodash", version: "4.17.21", ecosystem: "npm", paths: [["project", "lodash"]] }],
}));
scanPackagesMock.mockRejectedValue(
new Error("OSV batch query failed for https://api.osv.dev: fetch failed"),
);
const result = await runIndexModule();
const stderr = stripAnsi(result.stderr.join("\n"));
expect(result.exitCode).toBe(1);
expect(stderr).toContain("Error: OSV batch query failed for https://api.osv.dev: fetch failed");
expect(stderr).toContain("Hint: Outbound access to the OSV API may be blocked or restricted in this environment.");
expect(stderr).toContain("build the advisory DB on a machine with OSV access");
expect(stderr).toContain("cve-lite advisories sync --output /path/to/advisories.db");
});
it("routes verbose mode through the detailed printer pipeline", async () => {
const finding = createFinding({ severity: "medium" });
parseArgsMock.mockReturnValue({
command: "scan",
options: {
verbose: true,
failOn: "critical",
batchSize: "100",
searchDepth: "4",
minSeverity: "medium",
all: false,
},
projectArg: ".",
});
loadPackagesMock.mockReturnValue(
createScanInput({
packages: [finding.pkg],
warnings: ["Manifest fallback warning"],
skippedDependencies: ["dependencies:debug@^4.3.0"],
}),
);
scanPackagesMock.mockResolvedValue([finding]);
const result = await runIndexModule();
expect(result.exitCode).toBe(0);
expect(logWarnMock).toHaveBeenCalledWith("Manifest fallback warning", expect.anything());
expect(printSummaryMock).toHaveBeenCalled();
expect(printActionSummaryMock).toHaveBeenCalled();
expect(printPriorityFixesMock).toHaveBeenCalled();
expect(printFixPlanMock).toHaveBeenCalled();
expect(printCoverageMock).toHaveBeenCalledWith(["Parser note", "Coverage note"]);
expect(printSkippedDependenciesMock).toHaveBeenCalledWith(["dependencies:debug@^4.3.0"]);
expect(printTableMock).toHaveBeenCalled();
expect(printFinalStatusMock).toHaveBeenCalled();
expect(printCompactOutputMock).not.toHaveBeenCalled();
});
it("reports the local advisory database as the scan source in offline mode", async () => {
parseArgsMock.mockReturnValue({
command: "scan",
options: {
json: true,
offline: true,
offlineDb: "/tmp/advisories.db",
failOn: "critical",
batchSize: "100",
searchDepth: "4",
minSeverity: "medium",
},
projectArg: ".",
});
loadPackagesMock.mockReturnValue(createScanInput({
packages: [{ name: "lodash", version: "4.17.21", ecosystem: "npm", paths: [["project", "lodash"]] }],
}));
const result = await runIndexModule();
expect(result.exitCode).toBe(0);
expect(stripAnsi(result.stdout[0] ?? "")).toContain("Offline mode: enabled");
expect(stripAnsi(result.stdout[1] ?? "")).toContain("Advisory source: local advisory database");
expect(stripAnsi(result.stdout[1] ?? "")).toContain("/tmp/advisories.db");
expect(stripAnsi(result.stdout[2] ?? "")).toContain("Advisory DB freshness: synced");
});
it("warns when the local advisory DB appears stale", async () => {
const createAdvisorySourceMock = (await import("../src/scanner.js")).createAdvisorySource as jest.Mock;
createAdvisorySourceMock.mockReturnValueOnce({
advisorySource: { queryBatch: jest.fn(), getVuln: jest.fn() },
offline: true,
sourceLabel: "local advisory database (/tmp/advisories.db)",
advisoryDbMetadata: {
lastSyncAt: new Date(Date.now() - 10 * 24 * 60 * 60 * 1000).toISOString(),
sourceUrl: "https://storage.googleapis.com/osv-vulnerabilities/npm/all.zip",
},
advisoryDbIsStale: true,
cleanup: jest.fn(),
});
parseArgsMock.mockReturnValue({
command: "scan",
options: {
json: true,
offline: true,
offlineDb: "/tmp/advisories.db",
failOn: "critical",
batchSize: "100",
searchDepth: "4",
minSeverity: "medium",
},
projectArg: ".",
});
loadPackagesMock.mockReturnValue(createScanInput({
packages: [{ name: "lodash", version: "4.17.21", ecosystem: "npm", paths: [["project", "lodash"]] }],
}));
const result = await runIndexModule();
expect(result.exitCode).toBe(0);
expect(logWarnMock).toHaveBeenCalledWith(
"The local advisory DB appears stale. Re-run `cve-lite advisories sync` to refresh it.",
expect.anything(),
);
});
it("routes advisories sync through the sync module and exits successfully", async () => {
syncOsvAdvisoriesMock.mockResolvedValue({
advisoryCount: 2,
dbPath: "/tmp/advisories.db",
sourceUrl: "https://storage.googleapis.com/osv-vulnerabilities/npm/all.zip",
});
parseArgsMock.mockReturnValue({
command: "advisories-sync",
options: {
failOn: "critical",
batchSize: "100",
searchDepth: "4",
minSeverity: "medium",
output: "/tmp/advisories.db",
},
});
const result = await runIndexModule();
expect(result.exitCode).toBe(0);
expect(syncOsvAdvisoriesMock).toHaveBeenCalledWith(
expect.objectContaining({ outputPath: "/tmp/advisories.db", onProgress: expect.any(Function) }),
);
expect(loadPackagesMock).not.toHaveBeenCalled();
expect(result.stdout.some(line => stripAnsi(line).includes("Advisory sync complete (2 records)"))).toBe(true);
expect(result.stdout.some(line => stripAnsi(line).includes("Advisory database: synced 2 records"))).toBe(true);
});
it("applies validated direct fixes and rescans in --fix mode", async () => {
const finding = createFinding({ pkg: { name: "multer", version: "1.4.5-lts.2", ecosystem: "npm", paths: [["project", "multer"]] } });
parseArgsMock.mockReturnValue({
command: "scan",
options: {
fix: true,
failOn: "critical",
batchSize: "100",
searchDepth: "4",
minSeverity: "medium",
},
projectArg: ".",
});
loadPackagesMock
.mockReturnValueOnce(createScanInput({ source: "package-lock", filePath: "/tmp/project/package-lock.json", packages: [finding.pkg] }))
.mockReturnValueOnce(createScanInput({ source: "package-lock", filePath: "/tmp/project/package-lock.json", packages: [finding.pkg] }));
scanPackagesMock.mockResolvedValueOnce([finding]).mockResolvedValueOnce([]);
buildSuggestedFixCommandPlanMock.mockReturnValueOnce({
packageManager: "npm",
sourceLabel: "package-lock.json",
command: "npm install multer@2.1.1",
sections: [],
targets: [
{
package: "multer",
currentVersion: "1.4.5-lts.2",
targetVersion: "2.1.1",
kind: "direct",
urgent: false,
severity: "medium",
adjusted: false,
reason: "Direct upgrade target",
},
],
skipped: [],
});
const result = await runIndexModule();
const output = stripAnsi(result.stdout.join("\n"));
expect(result.exitCode).toBe(0);
expect(spawnMock).toHaveBeenCalledWith(
"npm",
["install", "multer@2.1.1"],
expect.objectContaining({ cwd: expect.any(String), stdio: ["ignore", "pipe", "pipe"] }),
);
expect(loadPackagesMock).toHaveBeenCalledTimes(2);
expect(scanPackagesMock).toHaveBeenCalledTimes(2);
expect(output).toContain("Applying fixes (--fix)");
expect(output).toContain("Applied fixes");
expect(output).toContain("Fix summary");
expect(printCompactOutputMock).not.toHaveBeenCalled();
expect(printSummaryMock).not.toHaveBeenCalled();
});
it("fails fast when --fix is used with --json", async () => {
parseArgsMock.mockReturnValue({
command: "scan",
options: {
fix: true,
json: true,
failOn: "critical",
batchSize: "100",
searchDepth: "4",
minSeverity: "medium",
},
projectArg: ".",
});
const result = await runIndexModule();
expect(result.exitCode).toBe(1);
expect(result.stderr.join("\n")).toContain("--fix cannot be used with --json");
});
describe("--report flag", () => {
it("calls writeHtmlReport and prints the report path", async () => {
const packages = [
{ name: "lodash", version: "4.17.21", ecosystem: "npm", paths: [["project", "lodash"]] },
];
loadPackagesMock.mockReturnValue(createScanInput({ packages }));
scanPackagesMock.mockResolvedValue([]);
parseArgsMock.mockReturnValue({
command: "scan",
options: {
failOn: "critical",
batchSize: "100",
searchDepth: "4",
minSeverity: "medium",
report: "./my-report",
noOpen: true,
},
projectArg: ".",
});
const result = await runIndexModule();
expect(writeHtmlReportMock).toHaveBeenCalledWith(
expect.objectContaining({
outputDir: expect.stringContaining("my-report"),
autoOpen: false,
})
);
const output = result.stdout.join("\n");
expect(output).toContain("/tmp/cve-report/index.html");
});
it("throws when --report and --json are both set", async () => {
parseArgsMock.mockReturnValue({
command: "scan",
options: {
failOn: "critical",
batchSize: "100",
searchDepth: "4",
minSeverity: "medium",
report: true,
json: true,
},
projectArg: ".",
});
const result = await runIndexModule();
expect(result.stderr.join("\n")).toContain("--report cannot be used with --json");
});
it("uses ./cve-report as default output dir when --report is true (boolean)", async () => {
const packages = [
{ name: "lodash", version: "4.17.21", ecosystem: "npm", paths: [["project", "lodash"]] },
];
loadPackagesMock.mockReturnValue(createScanInput({ packages }));
scanPackagesMock.mockResolvedValue([]);
parseArgsMock.mockReturnValue({
command: "scan",
options: {
failOn: "critical",
batchSize: "100",
searchDepth: "4",
minSeverity: "medium",
report: true,
noOpen: true,
},
projectArg: ".",
});
await runIndexModule();
const callArgs = writeHtmlReportMock.mock.calls[0][0];
expect(callArgs.outputDir).toContain("cve-report");
});
});
});