Closed inverted-capital closed 10 months ago
The behavior that you're seeing is a byproduct of what your test is doing and is not really related to Wallaby per se. What you are seeing is a result of how vitest
is executing your tests.
You can reproduce similar behavior / issues in vitest:
Start vitest in watch mode (npm run test
for your project), and change io.fixture.js
to return something other than return 'local reply'
; you will see that your test doesn't automatically re-execute as vitest doesn't know about the relationship between your code and your test because of the web worker.
Configure vitest to report on code coverage (instead of using Wallaby), and you will see that vitest thinks that io.fixture.js
is never executed:
vitest.config.js
import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
// https://vitejs.dev/config/
export default defineConfig({
plugins: [react()],
test: {
setupFiles: ['fake-indexeddb/auto'],
testTimeout: 500,
include: ['src/exec/io.test.js'],
coverage: {
enabled: true,
provider: 'v8',
},
},
})
At the moment, when you use expose
to run in the worker thread, you're effectively bypassing vitest
's execution pipeline (and also Wallaby's functionality).
In order for Wallaby to support your scenario, it would first need to be supported by vitest
itself. I'm not sure how feasible this is, but recommend you raise a feature request with them. If vitest
supports your scenario then it's possible Wallaby will simply work for you without us needing to do anything special.
thank you !!
I have a file https://github.com/dreamcatcher-tech/artifact/blob/main/src/exec/io.fixture.js that is loaded as a webworker or nodeworker in this place: https://github.com/dreamcatcher-tech/artifact/blob/19862cf837338d12105aa07dd405a8cf0e2f7021/src/exec/io.js#L57C35-L57C35
The problem is that the webworker code is not instrumented by wallaby and does not show the gutter feedback. If I put a debugger breakpoint in for the vscode debugger it will stop in this file, but wallaby seems to ignore it. How can I get the visual feedback from wallaby that I need ?
Wallaby diagnostics report