Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
// ],

"vitest.ignoreWorkspace": true,
"vitest.configSearchPatternInclude": "test/{core,cli,config,browser}/{vitest,vite}.{config.ts,config.unit.mts}",
"vitest.configSearchPatternInclude": "test/{core,cli,config,browser,reporters}/{vitest,vite}.{config.ts,config.unit.mts}",
"testing.automaticallyOpenTestResults": "neverOpen",

// Enable eslint for all supported languages
Expand Down
2 changes: 1 addition & 1 deletion packages/vitest/src/node/reporters/github-actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ export class GithubActionsReporter implements Reporter {
for (const error of task.result?.errors ?? []) {
projectErrors.push({
project,
title,
title: project.name ? `[${project.name}] ${title}` : title,
error,
file,
})
Expand Down
18 changes: 18 additions & 0 deletions test/reporters/tests/github-actions.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,24 @@ describe(GithubActionsReporter, () => {
expect(stderr).toBe('')
})

it('prints the project name when there is one', async () => {
let { stdout, stderr } = await runVitest(
{
name: 'test-project',
reporters: new GithubActionsReporter(),
root: './fixtures',
include: ['**/some-failing.test.ts'],
},
)
stdout = stdout.replace(resolve(import.meta.dirname, '..').replace(/:/g, '%3A'), '__TEST_DIR__')
expect(stdout).toMatchInlineSnapshot(`
"
::error file=__TEST_DIR__/fixtures/some-failing.test.ts,title=[test-project] some-failing.test.ts > 3 + 3 = 7,line=8,column=17::AssertionError: expected 6 to be 7 // Object.is equality%0A%0A- Expected%0A+ Received%0A%0A- 7%0A+ 6%0A%0A ❯ some-failing.test.ts:8:17%0A%0A
"
`)
expect(stderr).toBe('')
})

it('uses onWritePath to format path', async () => {
const { stdout, stderr } = await runVitest(
{
Expand Down
Loading