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

Globs are not working for $ istanbul instrument -x "**glob**" #596

Closed
ORESoftware opened this issue Jun 6, 2017 · 6 comments · Fixed by #1007
Closed

Globs are not working for $ istanbul instrument -x "**glob**" #596

ORESoftware opened this issue Jun 6, 2017 · 6 comments · Fixed by #1007

Comments

@ORESoftware
Copy link

I am trying to do this:

public
    /lib     # this is library code (angular etc.), I want to ignore this dir
    /pages   # this is my code

Here is the command I use:

istanbul instrument public --output public-coverage -x "public/lib/**/*"

Unfortunately, the public/lib directory still gets instrumented, which is a bummer because it contains a ton of files that are 3rd party libraries which I really do not want to instrument.

I have tried every glob combination under the sun and it's not working - the lib directory and its contents never get ignored, and they are always copied over to public-coverage and instrumented.

I consistently have problems with getting globs to behave as desired...it's not just this library. Not sure why that is, but maybe people should consider other ways of ignoring dirs, etc.

@ORESoftware
Copy link
Author

bump pls

@JaKXz
Copy link
Member

JaKXz commented Jun 7, 2017

@ORESoftware I think you're using the wrong executable, but you can configure nyc to ignore directories like this: https://github.com/istanbuljs/nyc#excluding-files

Please share your repo or a sample reproduction with nyc. I'd go as far as to unofficially say that the istanbul CLI is no longer supported, since nyc has replaced it. You can see the docs on the instrument command here: https://istanbul.js.org/docs/advanced/instrument/

@JaKXz JaKXz added invalid and removed invalid labels Jun 7, 2017
@ORESoftware
Copy link
Author

ORESoftware commented Jun 8, 2017

Thanks! I wonder why nyc didn't choose to stick with original CLI:

before:

istanbul instrument ./lib -o ./output

after?

nyc instrument ./lib ./output

maybe the --output/-o flag still works, whatever

@ORESoftware
Copy link
Author

ORESoftware commented Jun 8, 2017

Unfortunately putting this in package.json doesn't work:

"nyc": {
    "exclude": [
      "public/lib/**/*"
    ]
  }

nyc still attempts to instrument the public/lib contents

this is driving me INSANE

bump bump escalate

@bcoe
Copy link
Member

bcoe commented Jul 29, 2017

@ORESoftware could you please provide a link to a repository that is running into this issue?

Here's a unit test we have for logic very similar to what you're attempting:

https://github.com/istanbuljs/istanbuljs/blob/master/packages/test-exclude/test/test-exclude.js#L219

We're not doing anything exciting with our test-exclude logic, it simply runs a glob with a few nice defaults applied, e.g., always excluding node_modules.

If you are having trouble excluding /public/lib my guess is that there's something else odd happening, such as the path getting munged at some point during the instrumentation process.

@coreyfarrell
Copy link
Member

Fix being worked on in #1007

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

Successfully merging a pull request may close this issue.

4 participants