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

[Q] A way to conditionally exclude path #1030

Closed
Makpoc opened this issue Mar 15, 2019 · 4 comments
Closed

[Q] A way to conditionally exclude path #1030

Makpoc opened this issue Mar 15, 2019 · 4 comments
Labels

Comments

@Makpoc
Copy link

Makpoc commented Mar 15, 2019

Is there a way to conditionally exclude path from coverage? I have a project where I'm using nyc for test coverage for both unit and integration tests. I have a default set of excludes in package.json under nyc.exclude: [...]. I need to be able to add (preferably without replacing the defaults) few more files to exclude only for the unit-tests script (e.g. files related to db operations, that are required in the tested code, but are stubbed)

Any idea if that's possible?

@JaKXz
Copy link
Member

JaKXz commented Mar 15, 2019

@Makpoc you can do this in a nyc.config.js file, though I'm not sure if this has been released yet, @coreyfarrell?

@JaKXz JaKXz transferred this issue from istanbuljs/istanbuljs Mar 15, 2019
@JaKXz JaKXz added the question label Mar 15, 2019
@coreyfarrell
Copy link
Member

That feature is not yet released, it will be part of 14.0.0. I still have a couple patches that need to go in before I can do a release.

@Makpoc once 14.0.0 is released you will be able to create nyc.config.js that would export nyc configuration options. Once that's available you will be able to use any logic you want (for example appending the exclude list based on an environmental variable).

@Makpoc
Copy link
Author

Makpoc commented Mar 16, 2019

Great! Thanks. I found several references to nyc.config.js but it was way less then expected. I understand now why that was.

@coreyfarrell
Copy link
Member

nyc@14.0.0-alpha.0 has been released to npm to allow easier testing. Please note that additional breaking changes will occur before 14.0.0 final is released. I'm closing this issue, you can monitor release progress at #1051.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants