-
Notifications
You must be signed in to change notification settings - Fork 94
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: support for instrumenting files outside of current working directory #206
Conversation
Pull Request Test Coverage Report for Build 570
💛 - Coveralls |
This looks like a great start, just let me know when you're ready for review. |
0f2dcff
to
05bcc8e
Compare
@bcoe I think this is ready to go. Let me know what you think. |
@j03m awesome, I'll work on reviewing this weekend hopefully. |
@bcoe rebased |
I will investigate the cause of these test failures. |
That wasn't the case, I was just trying to test with |
The `lib/report` API can now receive additional arguments that allow it to pull in code from multiple directories even if those directories live outside of the invokers cwd. Additional bug fix: Fixed padding/new lines around source map urls (and added tests)
test/integration.js_10.snap
Outdated
@@ -255,13 +255,13 @@ exports[`c8 report generates report from existing temporary files 1`] = ` | |||
",--------------------------|---------|----------|---------|---------|-------------------------------- | |||
File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s | |||
--------------------------|---------|----------|---------|---------|-------------------------------- | |||
All files | 75.57 | 60.53 | 66.67 | 75.57 | | |||
All files | 75.51 | 59.49 | 67.65 | 75.51 | |
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.
Looks like some of these numbers changed as we use test/*.js
as the glob. So I updated the snap and adjusted the threshold in a test to keep the spirit of the test correct.
@bcoe this is in good state again. |
@j03m this is looking pretty reasonable to me. If I'm following, does this PR make it so that folders outside of If this PR is adding support for both, perhaps we should add a test for the case where the files in I also think that it might be worth thinking about how we would expose this behavior from the CLI, but I'd be willing to land this, as long as we have a tracking ticket to do this work. |
I believe it to be both and I think your instincts about the test case are correct. There are two "levers" so to speak that this change adds: First is the
The I will add the additional tests. |
Once I started writing the additional tests, I realize this would be much more seamless if I did a full integration pass. As suchI took a stab at what the ux for the cli would look like as well. I will push it as a second commit. Seems managable. I scaffolded this in and am working out tests . Any thoughts on two additional options and wording:
I wrestled with the idea of calling the 2nd option |
Pushed but looks like node10 failed. Investigating (passed locally?) |
04f3ca9
to
9fd16ec
Compare
My failures on node10 seemed to be related to tmp files from previous runs hanging around. I added a clean to some of my tests that seem to be impacted, but I'm noticing many tests have an explicit flag to clean=false. I was wondering why that is? |
@j03m historically, I believe, the test suite was doing a worse job of isolating its own coverage from the coverage being tested. I think the idea of |
We're currently leveraging the
index.js
programmatically viarequire("c8")
for a build system that is bit non standard in that multipledist
directories for various projects can be leveraged in a workspace that is outside the cwd of where the test are run.This change modifies the interface to
Report
but not the CLI in the following ways:src
to be supplied as a Array of string paths.src
isn't supplied, src is overridden to the defaultcwd
, the main CLI doesn't currently allow these directories to be supplied to avoid over complicating the CLI interface.allowExternal
is supplied and passed totest-exlude
to indicate that not all paths will be relative. Not supplying this flag causestest-exclude
to reject anything outside ofcwd
.Please don't merge this just yet as I'm still testing, writing tests. But I wanted to get your thoughts if this was a feasible enhancement.Edit: Okay I think this is ready to go.
Checklist
npm test
, tests passingnpm run test:snap
(to update the snapshot)