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

Cannot exclude test files from rollup bundle #340

Closed
nrabinowitz opened this issue Mar 25, 2019 · 1 comment
Closed

Cannot exclude test files from rollup bundle #340

nrabinowitz opened this issue Mar 25, 2019 · 1 comment

Comments

@nrabinowitz
Copy link

I'm using rollup to bundle a library I'm working on, using ES2015 import/export. My current test approach is to bundle my tests along with the code under test:

rollup test/index.js --file dist/test.js --sourcemap --format=cjs

This allows me to run the tests under Node, and use nyc like so:

nyc --clean -x 'test/**' node dist/test.js

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 of test/**/test/**, ./test/**, etc with no effect. I have also tried putting include/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, so include 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.

  • Is my test-bundling approach incorrect?
  • Is there a CLI option I've overlooked here?

Apologies if this is user error rather than a bug, but it seems that --exclude is not working as expected in this case.

@nrabinowitz
Copy link
Author

Closing in favor of istanbuljs/nyc#1042

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

No branches or pull requests

1 participant