mirror of
https://github.com/vitest-dev/vitest.git
synced 2025-12-08 18:26:03 +00:00
fix(reporters): show project in github reporter (#9138)
### Description <!-- Please insert your description here and provide especially info about the "what" this PR is solving --> Resolves #issue-number <!-- You can also add additional context here --> ### Please don't delete this checklist! Before submitting the PR, please make sure you do the following: - [ ] It's really useful if your PR references an issue where it is discussed ahead of time. If the feature is substantial or introduces breaking changes without a discussion, PR might be closed. - [ ] Ideally, include a test that fails without this PR but passes with it. - [ ] Please, don't make changes to `pnpm-lock.yaml` unless you introduce a new test example. - [ ] Please check [Allow edits by maintainers](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/allowing-changes-to-a-pull-request-branch-created-from-a-fork) to make review process faster. Note that this option is not available for repositories that are owned by Github organizations. ### Tests - [ ] Run the tests with `pnpm test:ci`. ### Documentation - [ ] If you introduce new functionality, document it. You can run documentation with `pnpm run docs` command. ### Changesets - [ ] Changes in changelog are generated from PR name. Please, make sure that it explains your changes in an understandable manner. Please, prefix changeset messages with `feat:`, `fix:`, `perf:`, `docs:`, or `chore:`.
This commit is contained in:
parent
1c00fb1165
commit
bb65e15c7f
2
.vscode/settings.json
vendored
2
.vscode/settings.json
vendored
@ -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
|
||||
|
||||
@ -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,
|
||||
})
|
||||
|
||||
@ -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(
|
||||
{
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user