Skip to content

Commit 0795ce0

Browse files
authored
testplan: skipping testplan if file is missing (#1379)
1 parent 67695cb commit 0795ce0

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

packages/allure-js-commons/src/sdk/reporter/testplan.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { readFileSync } from "node:fs";
1+
import { existsSync, readFileSync } from "node:fs";
22
import type { Label } from "../../model.js";
33
import type { TestPlanV1 } from "../types.js";
44
import { allureIdRegexp } from "../utils.js";
@@ -10,6 +10,12 @@ export const parseTestPlan = (): TestPlanV1 | undefined => {
1010
return undefined;
1111
}
1212

13+
if (!existsSync(testPlanPath)) {
14+
// eslint-disable-next-line no-console
15+
console.error("Test plan file is missing. Skipping test plan usage:", testPlanPath);
16+
return undefined;
17+
}
18+
1319
try {
1420
const file = readFileSync(testPlanPath, "utf8");
1521
const testPlan = JSON.parse(file) as TestPlanV1;

0 commit comments

Comments
 (0)