-
Notifications
You must be signed in to change notification settings - Fork 95
fix: do not override NODE_V8_COVERAGE if set (#70) #78
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
Conversation
9eb284b
to
71c44e1
Compare
How do you want me to test this properly? I think is messing up the snapshots too |
0706789
to
f4c9d66
Compare
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.
please do not merge yet
OK.
test/integration.js
Outdated
}) | ||
|
||
it('supports exeternally set NODE_V8_COVERAGE', () => { | ||
process.env.NODE_V8_COVERAGE = './coverage/tmp_' |
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.
Instead of overriding NODE_V8_COVERAGE
of the whole process, use spawnSync()
option to modify only this child process' environment.
test/parse-args.js
Outdated
process.argv = ['node', 'c8', '--foo=99', 'my-app', '--help'] | ||
const argv = buildYargs().parse(hideInstrumenteeArgs()) | ||
argv.tempDirectory.endsWith('/coverage/tmp_').should.be.equal(true) | ||
process.env.NODE_V8_COVERAGE = '' |
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 assume the original value is not ''
, as this test is run with c8
.
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 can delete
but that would create a side effect like setting it to ''
. I can use beforeEach
and store the original value. I am only doing it that particular test now.
f4c9d66
to
976b33c
Compare
While reviewing this, I found the existing test results are too fragile to add new specs... the snapshot of the first test affects the second one, the second affects the third, and so on. I think we should make each tests more independent before implementing new features. @kilianc, thanks for starting this work. |
Ok, I'll keep this parked here. @ me when I can continue! |
|
@kilianc Can you rebase this branch from |
👋 @kilianc it seems like this has stalled a bit, still a feature you need? Could you explain your use-case for me, I don't quite understand why you'd want to run |
@kilianc this is looking pretty good to me, what work would you still like to do? |
bin/c8.js
Outdated
} | ||
|
||
process.env.NODE_V8_COVERAGE = argv.tempDirectory | ||
if (!process.env.NODE_V8_COVERAGE) { |
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.
Which should c8 take precedence, when both NODE_V8_COVERAGE
environment variable and --tmp-directory
CLI flag are provided? The current implementation will choose NODE_V8_COVERAGE
in this case.
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.
--tmp-directory
should win, but we default it to NODE_V8_COVERAGE
if not set, we can get rid of this if
statement probably
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.
we can get rid of this
if
statement probably
👍
Quite the opposite! I am trying to give full ownership of the env to the caller, in my case CI. Instead of having to re-pass in the env as arg just to have it set again. I hope that makes sense |
BTW, not sure what is going on with |
I resolved my git issues but the test suite is still not passing. Will work on it this weekend, but I think the test suite still has some isolation problem. Cheers! |
@kilianc once I read up on your reasoning for this feature, I totally understand what you're going for 👍 excited to see this over the finish line; let me know if there's anything I can do to help. |
const { output } = spawnSync(nodePath, [ | ||
c8Path, | ||
'--exclude="test/*.js"', | ||
'--clean=false', |
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 think the test suite still has some isolation problem.
Use --temp-directory
option here to write coverage reports to a separate directory.
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.
@shinnn the goal of this test is indeed to use the env
and not --temp-directory
to set the path. Look at line 38!
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.
Ah, indeed.
@bcoe thanks, I think this is ready. Happy to fix anything that doesn't meet expectations :) |
@shinnn how are you feeling about this PR? |
@kilianc this look reasonable to me, but all the tests appear to be failing, any thoughts? |
@bcoe locally it was all passing, I'll try to rebase again! 🍺 |
@kilianc just wanted to bump this up, haven't unfortunately had the cycles to dig into the issues myself. Still something you'd like to land? |
@bcoe it is, it's just bandwidth. I'll do my best to get this done in the next week or so! Thanks for the bump :) |
closing in favor of #122; I think there was just a bad entry in the snapshot, from prior runs of your tests. |
WIP, please do not merge yet