-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
0.29.7 - 0.31.0 vitest no longer writes to outputFile.junit #3330
Comments
|
The JUnit test report is placed in coverage directory. When Vitest's JUnit reporter starts up it opens a file handle there. Next the coverage provider starts and cleans the old coverage reports by removing the coverage folder. This creates a conflict as coverage reporter did not expect anyone else to use its directory. This is unintentionally caused by #3131 vitest/packages/vitest/src/node/core.ts Lines 288 to 291 in 9836ccb
vitest/packages/vitest/src/node/reporters/junit.ts Lines 79 to 91 in 9836ccb
Before |
As work-around for now you can simply place the test report outside coverage report directory: reporters: ['default', 'junit'],
outputFile: {
- junit: './coverage/junit.xml',
+ junit: './any-other-directory/junit.xml',
} |
Yeah that's what I suspected, and am placing output in a tmp folder now and manually copying it back to coverage folder since my current CI flow (outside my control) expects a specific directory like
May I suggest either:
Happy to take a look and create a PR for this if you think it's okay but don't have the time. |
This first option sounds better. So the order would be reversed to be exactly as it was before #3131. But we'll still need to have - await this.report('onInit', this)
+ try {
await this.initCoverageProvider()
await this.coverageProvider?.clean(this.config.coverage.clean)
await this.initBrowserProviders()
+ }
+ finally {
+ await this.report('onInit', this)
+ } |
Describe the bug
As title says, I recently upgraded from 0.29.4 to 0.31 and noticed that
vitest coverage
produces coverage folder without custom test results file.Reproducible config in stackblitz link and here're the main lines:
The success message was printed during test runs
but
junit.xml
is not thereOnce I downgraded to 0.29.7, the test results are there again.
Reproduction
https://stackblitz.com/edit/vitest-dev-vitest-9cocmu?file=vite.config.ts&initialPath=__vitest__
System Info
Used Package Manager
pnpm
Validations
The text was updated successfully, but these errors were encountered: