-
-
Notifications
You must be signed in to change notification settings - Fork 361
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: instrument --complete-copy
implementation
#1056
feat: instrument --complete-copy
implementation
#1056
Conversation
With a few caveats: This will dereference symlinks as it copies them, in some cases this could be a problem i.e. `node_modules/.bin` This will not copy across empty directories
I think |
…haviour This default for `--complete-copy` has been set to false, meaning only instrumented files will be copied to the output directory in the default case.
full copy
implementation--complete-copy
implementation
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 looks pretty good, just the one little tweak.
1 similar comment
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 is looking like a great start 👍 thanks for the work @AndrewFinlay.
my major feedback is just that index.js
continues to get more complex, and I think it's potentially worth tearing out some of the instrument logic into a lib/instrument
helper.
I also wish we didn't need to pull in the cpr
module; but it does seem like this would be a pain to implement ourselves -- underscores that cp --recursive
would be nice to add to Node.js.
@@ -194,7 +196,15 @@ NYC.prototype.instrumentAllFiles = function (input, output, cb) { | |||
const stats = fs.lstatSync(input) | |||
if (stats.isDirectory()) { | |||
inputDir = input | |||
this.walkAllFiles(input, visitor) | |||
|
|||
const filesToInstrument = this.exclude.globSync(input) |
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.
instrumentAllFiles
is getting to be a pretty large method. I'd be tempted to potentially move this logic into lib/instrument
and split it into a couple helper methods.
we're going to defer refactoring for post 14.0.0
So this was split out from the
nyc instrument --include --exclude
work.When running
nyc instrument <input> <output>
this will copy everything across from input to output, excluding the.git
and<output>
folders.There are a few caveats though.
node_modules/.bin
.If I can't find a good fix for the symlinks problem, my gut feeling on this one is that this should probably be an opt in with a
--full
switch.