Skip to content

Commit e5e1ff3

Browse files
committed
Fix filepath
1 parent 83f3c55 commit e5e1ff3

File tree

2 files changed

+12
-10
lines changed

2 files changed

+12
-10
lines changed

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

Lines changed: 8 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import fs from 'fs';
2+
import pathlib from 'path';
23
import type { Reporter, RunnerTestFile, TestCase, TestModule, TestSuite, Vitest } from 'vitest/node';
34

45
function* formatTestCase(testCase: TestCase) {
@@ -64,9 +65,10 @@ export default class GithubActionsSummaryReporter implements Reporter {
6465
const passed = testModule.ok();
6566
// @ts-expect-error idk where else to get the file information from
6667
const file: RunnerTestFile = testModule.task;
68+
const relpath = pathlib.relative(testModule.project.config.root, file.filepath);
6769
const testCount = getTestCount(testModule);
6870

69-
this.writeStream.write(`### ${passed ? '✅' : '❌'} \`${file.filepath}\` (${testCount} test${testCount === 1 ? '' : 's'}) \n`);
71+
this.writeStream.write(`<h3>${passed ? '✅' : '❌'} <code>${relpath}</code> (${testCount} test${testCount === 1 ? '' : 's'})</h3>\n`);
7072

7173
this.writeStream.write('<ul>');
7274
for (const child of testModule.children) {
@@ -80,7 +82,7 @@ export default class GithubActionsSummaryReporter implements Reporter {
8082
const totalDuration = diagnostics.duration.toFixed(0);
8183

8284
this.writeStream.write('\n\n');
83-
this.writeStream.write(`#### Summary for \`${file.filepath}\`\n`);
85+
this.writeStream.write(`<h4>Summary for <code>${file.filepath}</code></h4>\n`);
8486
this.writeStream.write('<table>\n');
8587
this.writeStream.write(formatRow('Test Files', ''));
8688
this.writeStream.write(formatRow('Tests', testCount.toString()));

0 commit comments

Comments
 (0)