-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
feat!: use module-runner instead of vite-node #8208
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
feat!: use module-runner instead of vite-node #8208
Conversation
✅ Deploy Preview for vitest-dev ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
…t; branch 'main' of github.com:vitest-dev/vitest into feat/use-module-runner
@AriPerkkio for some reason in the browser V8 marks the ![]() ![]() But the log prints only once and the
The coverage from v8 is also different: // browser
{
scriptId: '77',
url: '/fixtures/src/Vue/Defined.vue',
functions: [
{
functionName: '',
ranges: [ { startOffset: 0, endOffset: 2244, count: 1 } ],
isBlockCoverage: true
},
{
functionName: 'setup',
ranges: [
{ startOffset: 247, endOffset: 584, count: 1 },
{ startOffset: 366, endOffset: 421, count: 0 }
],
isBlockCoverage: true
},
{
functionName: '_sfc_render',
ranges: [ { startOffset: 735, endOffset: 849, count: 1 } ],
isBlockCoverage: true
}
]
},
// happy-dom
{
scriptId: '866',
url: 'file:///vitest/test/coverage-test/fixtures/src/Vue/Defined.vue',
functions: [
{
functionName: '',
ranges: [ { startOffset: 0, endOffset: 409, count: 1 } ],
isBlockCoverage: true
},
{
functionName: '',
ranges: [ { startOffset: 13, endOffset: 409, count: 1 } ],
isBlockCoverage: true
},
{
functionName: 'get',
ranges: [ { startOffset: 304, endOffset: 364, count: 0 } ],
isBlockCoverage: false
}
],
startOffset: 209
}, |
For some reason the Vue's CSS query is now again included in coverage. The failing test is especially for this: vitest/test/coverage-test/fixtures/src/Vue/Defined.vue Lines 17 to 22 in a4df683
Previously these were filtered out, not anymore. I did not check why this happens. To reproduce, add following in function filterResult(coverage: Profiler.ScriptCoverage): boolean {
+ if (coverage.url.includes('.css')) {
+ return false
+ }
|
Do you remember why they were filtered before? Is it some kind of a glob? |
Looking at history, it seems it was related to the order of file loading: Relying on order seems unreliable. Let's actually do similar CSS request exclusion that we do for istanbul: vitest/packages/coverage-istanbul/src/provider.ts Lines 52 to 58 in a4df683
|
f65d582
to
53e4e10
Compare
Now this breaks even more code in Vue 😄 The number of branches increased to 10 in every provider (weird, because I only changed v8), but v8 and v8-browser now have a difference: // v8
{
"branches": "6/10 (60%)",
"functions": "5/7 (71.42%)",
"lines": "14/17 (82.35%)",
"statements": "15/18 (83.33%)",
}
// v8-browser
{
"branches": "6/10 (60%)",
"functions": "5/7 (71.42%)",
"lines": "13/16 (81.25%)",
"statements": "14/17 (82.35%)",
} |
All Taking a look |
I did a bit of a different change - I am filtering CSS requests here 60794d6 |
Could it be related to the
|
Oh, yes, that makes sense. But why would The generated code now looks like this: uncoveredMethodUsingImportMeta() {
return `Source maps tend to break when import meta is used: ${Object.assign(globalThis.__vitest_worker__?.metaEnv ?? import.meta.env).BASE_URL}`
}, Edit: v8 has more statements and lines than v8-browser |
@AriPerkkio thank you for commit! All works now 🎉 |
Description
Fixes #7888
Fixes #6667
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:
.