-
-
Notifications
You must be signed in to change notification settings - Fork 84
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
Coverage Reporting #136
Comments
Jest VS Code extension has this - if you're thinking of starting this it may be worth looking at their implementation for inspiration: https://github.com/jest-community/vscode-jest |
Yes +1 for this. I love using this Jest VS Code extension because of the code coverage feature. With the From here: |
I'm able to achieve this using this extension: https://marketplace.visualstudio.com/items?itemName=ryanluker.vscode-coverage-gutters You'll have to add .vscode/extensions.json {
"recommendations": [
"zixuanchen.vitest-explorer",
"ryanluker.vscode-coverage-gutters"
]
} .vscode/settings.json {
"vitest.enable": true,
"vitest.commandLine": "npx vitest --coverage"
} vitest.config.ts import { defineConfig } from "vitest/config";
export default defineConfig({
test: {
coverage: {
provider: "istanbul",
reporter: [
"text", // For the terminal
"lcov", // For the VSCode extension and browser
],
},
},
}); |
The jest one is way better than coverage gutters, and it also show the summary on the top of the target file. |
FYI VS Code has finalized an 'official' test coverage API: microsoft/vscode#123713 |
Coverage is now supported in https://github.com/vitest-dev/vscode/releases/tag/v0.5.14 This requires the latest Visual Studio Code 1.88. |
Is your feature request related to a problem? Please describe.
I run unit tests through the extension, and would like to also run coverage reports in it somehow. At the moment, I run
vitest run --coverage
in the terminalDescribe the solution you'd like
At first a button that will run the above terminal command for me.
Long term, I'd like to be able to show a panel/tab that has lines covered/uncovered, similar to other IDE's (Jetbrains example picture below).
Describe alternatives you've considered
None I can think of, this is just a nice to have really. Happy to continue with my current method if you want to keep the extension purely unit test based.
Additional context
I'm new to open source, but would be keen to give an implementation of this a shot! If you think it's worthwhile, I can look at submitting a PR.
In the first instance, I'd probably just try to have a button that checks to see if a coverage reporter is installed, and then run it in the terminal. If that goes well, then maybe look at getting fancier with displaying the output.
thanks,
Gavin
The text was updated successfully, but these errors were encountered: