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

Add include to CLI options #214

Merged
merged 10 commits into from
Apr 11, 2016
Merged

Conversation

rpominov
Copy link
Contributor

@rpominov rpominov commented Apr 3, 2016

See #207

@@ -46,6 +46,11 @@ var yargs = require('yargs/yargs')(process.argv.slice(2))
type: 'boolean',
describe: 'whether or not to instrument all files of the project (not just the ones touched by your test suite)'
})
.option('include', {
alias: 'in',
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i is taken unfortunately.

@rpominov
Copy link
Contributor Author

rpominov commented Apr 3, 2016

Also not 100% sure I did everything right, but I tested it in my project and it works fine.

@novemberborn
Copy link
Contributor

If we add include we should also add exclude.

@@ -46,6 +46,11 @@ var yargs = require('yargs/yargs')(process.argv.slice(2))
type: 'boolean',
describe: 'whether or not to instrument all files of the project (not just the ones touched by your test suite)'
})
.option('include', {
alias: 'in',
default: [],
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also from readme:

Note: include defaults to ['**']

But this default value probably defined somewhere else in the code. Should we remove it there, and specify ['**'] here. Although we need default value when it's loaded from package.json too, so maybe only specify here and not remove in other place?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code arrives at that ** default implicitly. I think we'd need a guard here for empty config.include arrays.

@rpominov
Copy link
Contributor Author

rpominov commented Apr 4, 2016

I haven't check yet that the latest changes work. Will check in my project a bit later.

@rpominov
Copy link
Contributor Author

rpominov commented Apr 4, 2016

Checked:

  • --all and include not set: all files included
  • --all --include **/src/**: only src included
  • --all and include: "**/src/**" in package.json: only src included
  • --all and exclude: "**/src/**" in package.json: src excluded
  • --all --exclude **/src/**: src excluded

Looking into the last case.

@rpominov
Copy link
Contributor Author

rpominov commented Apr 4, 2016

The last commit fixes last case.

@bcoe
Copy link
Member

bcoe commented Apr 5, 2016

@rpominov I really like this work 👍

would it be possible to add add a test; no need to add one for the CLI (since we don't have any tests for this yet, although it would be great to have some eventually). But it would be nice to have tests for the new logic that appends a list of excludes provided to the default excludes, and logic for the behavior around an include that's an empty list.

Also, mind rebasing to resolve conflicts 👍

@rpominov
Copy link
Contributor Author

rpominov commented Apr 5, 2016

@bcoe Ok, no problem. I think I'll be able to do this at the end of the week.

@rpominov rpominov force-pushed the include-option-cli branch from 0e42598 to 5f439a8 Compare April 9, 2016 10:49
@rpominov
Copy link
Contributor Author

rpominov commented Apr 9, 2016

I've rebased and added the tests, hope they're ok.

Also I wasn't able to make all current tests pass on my machine (in master, without changes of this PR). In particular this assertion fails, and this code fails with "file already exists" error. Probably this is just something wrong with my setup...

Also, man, running those tests splitted to individual files takes forever 😯

@novemberborn
Copy link
Contributor

LGTMO!


var nyc = (new NYC({
require: argv.require
require: argv.require,
include: argv.include,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@novemberborn Maybe we could check for ** here before passing to new NYC?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yea, or we change the NYC implementation. Let's see what @bcoe suggests.

@bcoe
Copy link
Member

bcoe commented Apr 10, 2016

@novemberborn @rpominov I made a couple small tweaks, and added tests. see:

rpominov#4

some small tweaks to --include, --exclude also adds tests
@rpominov
Copy link
Contributor Author

@bcoe Thanks, merged. The commits log of this PR gets a little messy, should I squash the commits?

@bcoe
Copy link
Member

bcoe commented Apr 11, 2016

@rpominov no worries 👍 I've started using the squash button when I merge commits, along with this slick new library:

https://github.com/conventional-changelog/standard-version

@bcoe bcoe merged commit f8a02b4 into istanbuljs:master Apr 11, 2016
@rpominov
Copy link
Contributor Author

Ah, right, forgot that github now can do squash. And standard-version looks very cool 👍

@bcoe
Copy link
Member

bcoe commented Apr 11, 2016

@rpominov this is now released in [email protected].

@rpominov
Copy link
Contributor Author

@bcoe Great. Thanks!

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

Successfully merging this pull request may close these issues.

3 participants