-
-
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
feat: add include
and exclude
options to instrument command
#1007
Merged
coreyfarrell
merged 17 commits into
istanbuljs:master
from
AndrewFinlay:instrument-include-exclude-option
Apr 4, 2019
Merged
Changes from 14 commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
d576e44
Added `include` and `exclude` options for instrument command
39db2cc
Merge branch 'master' into instrument-include-exclude-option
880ccde
Merge branch 'master' into instrument-include-exclude-option
5f76838
Merge branch 'master' into instrument-include-exclude-option
5174d12
`nyc instrument` copies all files to an output directory, then adds i…
bd25a38
Use `var cov_` rather than `_cov` in tests
02bc210
nyc instrument now copies all files, with permissions, from `input` t…
b2eb670
Update tests, prevent in place instrumentation and instrumentation ou…
995aa1a
Include missing test files
5a28941
Ignore file permissions test if running on Windows
d22c585
Use process.platform instead of os.platform
fd69f9a
Merge branch 'master' into instrument-include-exclude-option
1fbc204
Clean up copy remaining files for nyc instrument command
e1a1b94
Make sure we can instrument the root directory
17e4736
Merge in master, update test title
6852bbf
Merge branch 'master' into instrument-include-exclude-option
8903365
Split PR such that this only handles `nyc instrument --include --excl…
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"exclude": [ | ||
"**/exclude-me/**" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
output-dir | ||
!node_modules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
'use strict'; | ||
console.log('Hello, World!') |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suspect this is a problem for
nyc instrument . output
if./lib/output/data.json
exists (that output folder should be copied). Instead of ignoring**/${path.basename(output)}
couldn't we just ignoreoutput
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This only produces a list of top level files using
glob.sync(`${path.resolve(input)}/*`, ...)
, so the inclusion of**/${path.basename(output)}
won't exclude any further sub-dirs. The recursive copy of each top level sub-dir is then handled byfs-extra.copySync
. I agree it looks a little silly and should really be justoutput
, but I couldn't get it to work withglob.sync
. I should point out that this also means we're only ignoring.git
directories at the top level in this implementation.Anyway I'll see if I can come up with a nicer solution here, in the meantime I'll drop in the change below and rebase
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What if someone does
nyc instrument . subdir/output
? In that case wouldn't we need to ignoresubdir
, notoutput
? I ask due to the use ofpath.basename
.