Skip to content

Conversation

AriPerkkio
Copy link
Member

@AriPerkkio AriPerkkio commented Aug 10, 2025

Description

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 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:.

Copy link

netlify bot commented Aug 10, 2025

Deploy Preview for vitest-dev ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit 9d43490
🔍 Latest deploy log https://app.netlify.com/projects/vitest-dev/deploys/6898522f1883a30008addb6f
😎 Deploy Preview https://deploy-preview-8418--vitest-dev.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

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,
Copy link
Member Author

@AriPerkkio AriPerkkio Aug 10, 2025

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.

@AriPerkkio AriPerkkio force-pushed the fix/v8-coverage-query-params branch from 14e2423 to 9d43490 Compare August 10, 2025 08:02
Copy link

pkg-pr-new bot commented Aug 10, 2025

@vitest/browser

npm i https://pkg.pr.new/@vitest/browser@8418

@vitest/coverage-istanbul

npm i https://pkg.pr.new/@vitest/coverage-istanbul@8418

@vitest/coverage-v8

npm i https://pkg.pr.new/@vitest/coverage-v8@8418

@vitest/expect

npm i https://pkg.pr.new/@vitest/expect@8418

@vitest/mocker

npm i https://pkg.pr.new/@vitest/mocker@8418

@vitest/pretty-format

npm i https://pkg.pr.new/@vitest/pretty-format@8418

@vitest/runner

npm i https://pkg.pr.new/@vitest/runner@8418

@vitest/snapshot

npm i https://pkg.pr.new/@vitest/snapshot@8418

@vitest/spy

npm i https://pkg.pr.new/@vitest/spy@8418

@vitest/ui

npm i https://pkg.pr.new/@vitest/ui@8418

@vitest/utils

npm i https://pkg.pr.new/@vitest/utils@8418

vite-node

npm i https://pkg.pr.new/vite-node@8418

vitest

npm i https://pkg.pr.new/vitest@8418

@vitest/web-worker

npm i https://pkg.pr.new/@vitest/web-worker@8418

@vitest/ws-client

npm i https://pkg.pr.new/@vitest/ws-client@8418

commit: 93cf5cc

@AriPerkkio AriPerkkio marked this pull request as ready for review August 10, 2025 11:01
@AriPerkkio
Copy link
Member Author

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.

@sheremet-va sheremet-va merged commit a400a9d into vitest-dev:main Aug 15, 2025
13 of 15 checks passed
@AriPerkkio AriPerkkio deleted the fix/v8-coverage-query-params branch August 15, 2025 14:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Coverage issue v8 with Vue SFC and TSX Coverage stays at 100% for components regardless of the existence of any component test
2 participants