Skip to content
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

fix: collect coverage using node inspector (fix #378) #584

Merged
merged 6 commits into from Jan 23, 2022

Conversation

Demivan
Copy link
Member

@Demivan Demivan commented Jan 19, 2022

Fixes #378

For now this is just a proof of concept.
Tested on fluent-vue and vitest reports incorrect coverage for it. With detailed coverage enabled it is much better now.
It still reports wrong code lines though.

edit:

Coverage is almost the same as it would be if Vitest waited for all coverage files to finish writing to disk. Tested on fluent-vue.

With "wait for coverage to be written" fix:

File % Stmts % Branch % Funcs % Lines Uncovered Line #s
All files 93.55 92.66 86.84 93.55
src 93.64 96.92 88 93.64
TranslationContext.ts 100 100 100 100
composition.ts 100 100 100 100
getContext.ts 100 94.73 100 100 27
index.ts 80.41 90 72.72 80.41 65-83
inheritBundle.ts 100 100 100 100
symbols.ts 100 100 100 100
src/util 100 80 100 100
camelize.ts 100 100 100 100
warn.ts 100 66.66 100 100 7
src/vue 92.82 87.17 81.81 92.82
component.ts 100 100 100 100
directive.ts 88.8 81.48 75 88.8 52-55,98-107

This implementation:

File % Stmts % Branch % Funcs % Lines Uncovered Line #s
All files 95.5 87.87 91.66 95.5
src 93.64 95.23 88 93.64
TranslationContext.ts 100 100 100 100
composition.ts 100 100 100 100
getContext.ts 100 91.66 100 100 27
index.ts 80.41 88.88 72.72 80.41 65-83
inheritBundle.ts 100 100 100 100
symbols.ts 100 100 100 100
src/util 100 66.66 100 100
camelize.ts 100 100 100 100
warn.ts 100 50 100 100 7
src/vue 97.94 76.19 100 97.94
component.ts 100 100 100 100
directive.ts 96.8 64.28 100 96.8 52-55

@netlify
Copy link

netlify bot commented Jan 19, 2022

✔️ Deploy Preview for vitest-dev ready!

🔨 Explore the source changes: b195108

🔍 Inspect the deploy log: https://app.netlify.com/sites/vitest-dev/deploys/61ed248e3bec4d0007cf20b3

😎 Browse the preview: https://deploy-preview-584--vitest-dev.netlify.app

@Demivan Demivan changed the title fix: collect coverage using node inspector fix: collect coverage using node inspector (fix #378) Jan 19, 2022
@Demivan Demivan marked this pull request as draft January 19, 2022 16:03
@Demivan
Copy link
Member Author

Demivan commented Jan 20, 2022

@antfu @patak-dev Can you check this out?
This feels like much cleaner way of collecting coverage. I just don't know why coverage lines are reported incorrectly.

@Demivan Demivan marked this pull request as ready for review January 20, 2022 21:38
@Demivan Demivan marked this pull request as draft January 20, 2022 22:03
@Demivan Demivan marked this pull request as ready for review January 23, 2022 09:57
@antfu antfu merged commit de33284 into vitest-dev:main Jan 23, 2022
@antfu
Copy link
Member

antfu commented Jan 23, 2022

Let's give it a try!

@Demivan
Copy link
Member Author

Demivan commented Jan 23, 2022

@antfu Coverage of fluent-vue did not change fluent-vue/fluent-vue#749 (comment) - that is good, and #378 is fixed.

Only downside is that you now get messages in console when running coverage:

Debugger listening on ws://127.0.0.1:44445/34776132-750c-4d57-ab2c-21b6f6f3172d
For help, see: https://nodejs.org/en/docs/inspector

Will check if I can disable this output.

@Demivan
Copy link
Member Author

Demivan commented Jan 23, 2022

Will check if I can disable this output.

Cannot disable this message, NodeJs will always print it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Coverage report not including any files
2 participants