Use settings from .istanbul.yml when configuring instrumenter #13
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.
I've just tried this out against a test suite that opens 300+ subprocess during the run and it works great, so thanks!
There was an issue with some tests though, specifically tests covering code that uses the heredoc package would fail when run wrapped by this module. This is because normally, instrumenting a file results in all comments being stripped from it, and heredoc uses a comment-based workaround to enable multi-line strings.
There is an option that can be provided to the istanbul instrumenter to preserve comments - this changes how the instrumenter is initialised, so its options can be read out of a
.istanbul.yml
file in the project root and passed in.The other three passed in options I don't actually need, but they match how the instrumenter is initialised by istanbul's own CLI command.
Provided you're OK with the change, guidance on how to test this would be appreciated - I'd normally move the
new istanbul.Instrumenter
into theNYC
constructor, then bring insinon
to stub the return value of loadFile and assertnew istanbul.Instrumenter
was called with it, but it looks like that may not be inline with this project's style?