-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(vitest): show
beforeAll/afterAll
errors in junit reporter (#4819)
- Loading branch information
Showing
5 changed files
with
82 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import { | ||
afterAll, | ||
beforeAll, | ||
describe, | ||
it, | ||
} from 'vitest'; | ||
|
||
describe('suite with beforeAll', () => { | ||
beforeAll(() => { | ||
throw new Error('beforeAll error'); | ||
}); | ||
|
||
it('ok 1', () => {}); | ||
it('ok 2', () => {}); | ||
it.skip('skip 1', () => {}); | ||
}); | ||
|
||
describe('suite with afterAll', () => { | ||
afterAll(() => { | ||
throw new Error('afterAll error'); | ||
}); | ||
|
||
it('ok 1', () => {}); | ||
it('ok 2', () => {}); | ||
it.skip('skip 1', () => {}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import { defineConfig } from 'vitest/config' | ||
|
||
export default defineConfig({}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html | ||
|
||
exports[`emits <failure> when beforeAll/afterAll failed 1`] = ` | ||
"<?xml version="1.0" encoding="UTF-8" ?> | ||
<testsuites name="vitest tests" tests="8" failures="2" errors="0" time="..."> | ||
<testsuite name="basic.test.ts" timestamp="..." hostname="..." tests="8" failures="2" errors="0" skipped="2" time="..."> | ||
<testcase classname="basic.test.ts" name="suite with beforeAll > ok 1" time="..."> | ||
</testcase> | ||
<testcase classname="basic.test.ts" name="suite with beforeAll > ok 2" time="..."> | ||
</testcase> | ||
<testcase classname="basic.test.ts" name="suite with beforeAll > skip 1" time="..."> | ||
<skipped/> | ||
</testcase> | ||
<testcase classname="basic.test.ts" name="suite with afterAll > ok 1" time="..."> | ||
</testcase> | ||
<testcase classname="basic.test.ts" name="suite with afterAll > ok 2" time="..."> | ||
</testcase> | ||
<testcase classname="basic.test.ts" name="suite with afterAll > skip 1" time="..."> | ||
<skipped/> | ||
</testcase> | ||
<testcase classname="basic.test.ts" name="suite with beforeAll" time="..."> | ||
<failure message="beforeAll error" type="Error"> | ||
Error: beforeAll error | ||
❯ basic.test.ts:10:11 | ||
</failure> | ||
</testcase> | ||
<testcase classname="basic.test.ts" name="suite with afterAll" time="..."> | ||
<failure message="afterAll error" type="Error"> | ||
Error: afterAll error | ||
❯ basic.test.ts:20:11 | ||
</failure> | ||
</testcase> | ||
</testsuite> | ||
</testsuites> | ||
" | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters