An example on how to get test coverage with NYC for VS Code extensions.
- GUI to pick a test suite files
- Preselect
-
Added
nyc
todevDependencies
npm install --save-dev nyc
-
Added
npm: pretest
task which is used by 'Extension Tests (Coverage)' configuration -
Added
Extension Tests (Select)
configuration- Shows GUI to pick a test suite files
- Preselects with currently open file
-
Added
Extension Tests (Coverage)
configuration- Shows GUI to pick a test suite files
- Preselects with currently open file
- Generates a test coverage report
-
Added
nyc-coverage-test-runner.ts
These additions make it easier to see coverage report in isolation.
For example:
Running test coverage for module-c
in this example will show 100% coverage.
While running test coverage for module-a
& module-b
will show
as their test suites are missing some branches.
Coverage report will be empty with *
as one of the activationEvents
in package.json
.