Skip to content

Commit

Permalink
fix(coverage): env-replacer to remove query params from sourcemaps
Browse files Browse the repository at this point in the history
- Fixes bugs where vue components lost coverage when import.meta.env is used
  • Loading branch information
AriPerkkio committed Dec 31, 2022
1 parent 548bd49 commit a584a21
Show file tree
Hide file tree
Showing 2 changed files with 426 additions and 6 deletions.
7 changes: 6 additions & 1 deletion packages/vitest/src/node/plugins/envReplacer.ts
Expand Up @@ -27,7 +27,12 @@ export const EnvReplacerPlugin = (): Plugin => {
if (s) {
return {
code: s.toString(),
map: s.generateMap({ hires: true, source: id }),
map: s.generateMap({
hires: true,

// Remove possible query parameters, e.g. vue's "?vue&type=script&src=true&lang.ts"
source: id.split('?')[0],
}),
}
}
},
Expand Down

0 comments on commit a584a21

Please sign in to comment.