-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
fix(coverage): handle query param based transforms correctly #8418
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): handle query param based transforms correctly #8418
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. |
// we are using a normalized file name by default because this is what | ||
// Vite expects in the source maps handler | ||
filename: module.file || filename, | ||
filename: module.id, |
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.
The module.file || filename
did not contain query params. module.id
does. We need to have the query present in vm.RunningCodeOptions.filename
so that V8 reports those files properly. Otherwise we would see same file URL multiple times, and could not identify which coverage belongs to which file transform.
Before:
{
scriptId: '305',
url: 'file:///Users/ari/Git/vitest/test/coverage-test/fixtures/src/query-param-transformed.ts',
functions: [...]
}
{
scriptId: '306',
url: 'file:///Users/ari/Git/vitest/test/coverage-test/fixtures/src/query-param-transformed.ts',
functions: [...]
}
{
scriptId: '307',
url: 'file:///Users/ari/Git/vitest/test/coverage-test/fixtures/src/query-param-transformed.ts',
functions: [...]
}
After:
{
scriptId: '305',
url: 'file:///Users/ari/Git/vitest/test/coverage-test/fixtures/src/query-param-transformed.ts',
functions: [...]
}
{
scriptId: '306',
url: 'file:///Users/ari/Git/vitest/test/coverage-test/fixtures/src/query-param-transformed.ts%3Fquery=first',
functions: [...]
}
{
scriptId: '307',
url: 'file:///Users/ari/Git/vitest/test/coverage-test/fixtures/src/query-param-transformed.ts%3Fquery=second',
functions: [...]
}
Note that the offset of functions
there maps to different positions, based on query params.
14e2423
to
9d43490
Compare
@vitest/browser
@vitest/coverage-istanbul
@vitest/coverage-v8
@vitest/expect
@vitest/mocker
@vitest/pretty-format
@vitest/runner
@vitest/snapshot
@vitest/spy
@vitest/ui
@vitest/utils
vite-node
vitest
@vitest/web-worker
@vitest/ws-client
commit: |
Marking #6029 as linked too, as the minimal reproduction seems to work properly with this fix. I guess the auto-import does something with query params. |
Description
Please don't delete this checklist! Before submitting the PR, please make sure you do the following:
pnpm-lock.yaml
unless you introduce a new test example.Tests
pnpm test:ci
.Documentation
pnpm run docs
command.Changesets
feat:
,fix:
,perf:
,docs:
, orchore:
.