-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Browser mode: Istanbul coverage report incomplete #3514
Comments
@lsim are you using the |
Thanks for your input! It's something to look into. That option is on by default and I hadn't disabled it. So yes - I am using that. If I'm reading the docs right, I don't need it. Disabling it stops all my browser tests from running though. No errors, no output. I'll do a bit more experimenting |
Weirdly with
Presumably from this line: vi.stubGlobal('chrome', chrome); Same tests work when running in headless chrome. This endeavour is a bit like walking blindfolded through a mine field :) I guess for now I'll settle for the path that gives me working tests and broken coverage metrics. |
I can't get my tests to run without the It seems like the instrumented code that the test is running on is mapping incorrectly to the source code. In |
This should be fixed in 0.32.1
Maybe we need to provide |
@sheremet-va I added |
Also just updated to |
@lsim I explored this some more and I believe the issue is not due to @sheremet-va I'm happy to make a PR if you can point me in the right direction. Do tests for this belong in From the readme: While debugging, I noticed that Removing So far I don't think there is an issue with the |
@sheremet-va I've added a PR (#3806). First time contributing to this repo and I left some notes for the reviewer. Thanks. |
@elby22 your analysis on the root cause sounds correct. The browser runner is using different hook when compared to NodeJS's worker_thread/child_process runner. vitest/packages/browser/src/client/runner.ts Lines 42 to 46 in 8693449
vitest/packages/vitest/src/runtime/entry.ts Lines 67 to 72 in 8693449
I think the |
Fixed in #3806. |
Describe the bug
The following test file causes trouble with vitest in browser mode (chrome). Notice the nested
describe
calls:What seems to happen is that all three tests are run (and pass), but only the
should baz
andshould foo
count towards the coverage report. In the repro repo, this means line coverage is reported as 66%.The issue only occurs when the tests are browser based. With the jsdom environment, things work as expected and the coverage is reported as 100%.
Reproduction
Reproduction repo is here
System Info
Used Package Manager
yarn
Validations
The text was updated successfully, but these errors were encountered: