-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
fix(coverage): browser + v8 in source tests missing #7946
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
fix(coverage): browser + v8 in source tests missing #7946
Conversation
✅ Deploy Preview for vitest-dev ready!Built without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify project configuration. |
528b7af to
21a2dad
Compare
| if (coverage.url.includes('?browserv=') || coverage.url.includes('&browserv=')) { | ||
| return false | ||
| } | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need to check with Storybook folks to see that this doesn't break coverage reports there. This was used to exclude *.stories.* from appearing in coverage report.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
*.stories.* are now visible on coverage report 😢
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Storybook can now exclude story files inside the configureVitest hook
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, that works! Using this in fresh Storybook project fixes the issue:
{
name: "exclude-stories",
configureVitest(context) {
if (context.vitest.config.coverage.enabled) {
context.vitest.config.coverage.exclude.push("**/*.stories.**");
}
},Related tests in #8009
@vitest/browser
@vitest/coverage-istanbul
@vitest/expect
@vitest/coverage-v8
@vitest/mocker
@vitest/pretty-format
@vitest/runner
@vitest/spy
@vitest/snapshot
@vitest/ui
@vitest/utils
vite-node
vitest
@vitest/web-worker
@vitest/ws-client
commit: |
21a2dad to
c5e4c24
Compare
| const project = parentServer.vitest.getProjectByName(parentServer.config.name) | ||
| if (!project._isCachedTestFile(id) || !code.includes('import.meta.vitest')) { | ||
|
|
||
| if (!project._isCachedTestFile(filename) || !code.includes('import.meta.vitest')) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change is needed so that /Users/x/vitest/test/coverage-test/fixtures/src/in-source.ts?import&browserv=1747838764408 is recognized as cached test file.
Description
Please don't delete this checklist! Before submitting the PR, please make sure you do the following:
pnpm-lock.yamlunless you introduce a new test example.Tests
pnpm test:ci.Documentation
pnpm run docscommand.Changesets
feat:,fix:,perf:,docs:, orchore:.