-
-
Notifications
You must be signed in to change notification settings - Fork 360
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
Cannot exclude test files from rollup bundle #1042
Comments
I believe this issue is fixed by #1010 but is not yet released (will become nyc@14.0.0). Could you test by reinstalling nyc from the Tests are excluded from coverage by default but the currently releases of nyc do not exclude coverage based on source-maps, so it just sees the bundle as a whole and reports on everything in it. That is what #1010 fixes. |
@coreyfarrell Yes! That fixes the issue - thanks, I've been banging my head against this. |
|
I'm using
rollup
to bundle a library I'm working on, using ES2015import
/export
. My current test approach is to bundle my tests along with the code under test:This allows me to run the tests under Node, and use
nyc
like so:The test coverage shows that the sourcemaps are recognized and used - the coverage is broken out properly by source file. However, the
-x
/--exclude
param is not properly excluding tests or other files I want to exclude, and these show up in the coverage report. I have tried every glob combination oftest
/**/test/**
,./test/**
, etc with no effect. I have also tried puttinginclude
/exclude
in the"nyc"
stanza of package.json.If I specify
--include='lib/**'
, I get no coverage at all, but--include='dist/test**'
works, and shows me the mapped files, soinclude
at least is being processed relative to the filesystem. Using-x 'dist/test**' --include='dist/test**'
gives me no coverage at all. So it's pretty certain that--exclude
is being processed relative to the filesystem as well, regardless of how I set--exclude-after-remap
.Apologies if this is user error rather than a bug, but it seems that
--exclude
is not working as expected in this case.The text was updated successfully, but these errors were encountered: