D
Deno

help

How to exclude vendor directory from test coverage?

KKyleJune9/25/2022
https://deno.land/manual@v1.25.4/testing/coverage Here it says by default it will exclude test\.(ts|tsx|mts|js|mjs|jsx|cjs|cts) and only include specifiers matching ^file:. If I wanted to keep the current behavior but also exclude my vendor directory how would I do that? Before this I tried excluding them from codecov by using the following codecov.yml in my .github directory but it didn't work and still shows coverage for my vendor directory.
comment: false
codecov:
require_ci_to_pass: true
coverage:
status:
project:
default:
informational: true
ignore:
- "vendor/**/*"
- "public/**/*"
comment: false
codecov:
require_ci_to_pass: true
coverage:
status:
project:
default:
informational: true
ignore:
- "vendor/**/*"
- "public/**/*"
Here is the documentation where it says how to ignore paths in codecov. I've also tried just doing vendor but that didn't work either. https://docs.codecov.com/docs/ignoring-paths Since I couldn't get codecov to ignore it correctly, I want to try getting deno coverage to instead.
Codecov
Ignoring Paths
You can use the top-level ignore: key to tell Codecov to ignore certain paths. Add a list of paths (folders or file names) to your codecov.yml file under the ignore key to exclude files from being collected by Codecov. Ignored files will be skipped during processing. The following are examples of di...
UUUnknown User9/25/2022
Message Not Public
Sign In & Join Server To View
KKyleJune9/25/2022
yea, but codecov uploads the coverage files. If I can get deno to not generate coverage files for my vendor directory, I won't have this problem of codecov showing coverage for that directory.
UUUnknown User9/25/2022
4 Messages Not Public
Sign In & Join Server To View
KKyleJune9/25/2022
I want to but it says that would override the default. I want to add exclusions rather than replace the default exclusion/inclusions. The manual says the following.
These filters can be overridden using the --exclude and --include flags. A module specifier must match the include_regular expression and not match the exclude_ expression for it to be a part of the report.
These filters can be overridden using the --exclude and --include flags. A module specifier must match the include_regular expression and not match the exclude_ expression for it to be a part of the report.
I'm going to try deno coverage --exclude="(test\.(ts|tsx|mts|js|mjs|jsx|cjs|cts)|^vendor/.*|^public/.*)" --lcov cov > cov.lcov but it's a bit ugly. Would be great if the manual were updated to include examples. nope, looks like that didn't work.
UUUnknown User9/25/2022
2 Messages Not Public
Sign In & Join Server To View
KKyleJune9/25/2022
It says that about the coverage command though.
By default, deno coverage will exclude any files matching the regular expression test\.(ts|tsx|mts|js|mjs|jsx|cjs|cts) and only consider including specifiers matching the regular expression ^file: - ie. remote files will be excluded from coverage report.
By default, deno coverage will exclude any files matching the regular expression test\.(ts|tsx|mts|js|mjs|jsx|cjs|cts) and only consider including specifiers matching the regular expression ^file: - ie. remote files will be excluded from coverage report.
KKyleJune9/26/2022
I went ahead and created an issue for this on denoland/manual. https://github.com/denoland/manual/issues/406
GitHub
Add example for excluding vendored dependency from deno coverage ...
The manual page for testing coverage mentioned that there are default inclusions/exclusions and that if you add either of those flags it would override those defaults. However it doesn't sh...

Looking for more? Join the community!