Skip to content

Commit e40606d

Browse files
committed
Fix an undefined check?
1 parent 7981a8f commit e40606d

File tree

3 files changed

+5
-2
lines changed

3 files changed

+5
-2
lines changed

lib/vitest-reporter/build/test-reporter.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ var GithubActionsSummaryReporter = class extends BasicReporter {
4343
this.writeStream.write("<h3>Test Results</h3>");
4444
for (const file of files) {
4545
const testModule = this.vitest.state.getReportedEntity(file);
46+
if (testModule === void 0) continue;
4647
const passed = testModule.ok();
4748
const testCount = getTestCount(testModule);
4849
this.writeStream.write(`${passed ? "\u2705" : "\u274C"} \`${file.filepath}\` (${testCount} test${testCount === 1 ? "" : "s"})

lib/vitest-reporter/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
},
1919
"scripts": {
2020
"build": "yarn build:coverage-reporter && yarn build:test-reporter",
21-
"build:coverage-reporter": "esbuild --outfile=./dist/coverage-reporter.cjs --format=cjs --bundle=true --external:\"istanbul-lib-report\" --platform=node src/coverage-reporter.cts",
22-
"build:test-reporter": "esbuild --outfile=./dist/test-reporter.js --format=esm --bundle=true --external:\"vitest*\" --platform=node src/test-reporter.ts"
21+
"build:coverage-reporter": "esbuild --outfile=./build/coverage-reporter.cjs --format=cjs --bundle=true --external:\"istanbul-lib-report\" --platform=node src/coverage-reporter.cts",
22+
"build:test-reporter": "esbuild --outfile=./build/test-reporter.js --format=esm --bundle=true --external:\"vitest*\" --platform=node src/test-reporter.ts"
2323
}
2424
}

lib/vitest-reporter/src/test-reporter.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,8 @@ export default class GithubActionsSummaryReporter extends BasicReporter {
5555
this.writeStream.write('<h3>Test Results</h3>');
5656
for (const file of files) {
5757
const testModule = this.vitest!.state.getReportedEntity(file) as TestModule;
58+
if (testModule === undefined) continue;
59+
5860
const passed = testModule.ok();
5961
const testCount = getTestCount(testModule);
6062

0 commit comments

Comments
 (0)