-
Notifications
You must be signed in to change notification settings - Fork 91
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
Increase Code Quality By Increasing Code Coverage: lib/parse-args.js #447
Conversation
8978fe1
to
175d031
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.
Thanks for the contribution, I'm excited to improve the coverage of c8.
In this PR specifically, I don't like that it changes the behaviour in subtle ways:
- default will no longer give a hint in the UI that shows that we've defaulted to NODE_V8_COVERAGE.
- The path of
tempDirectory
will no longer be an absolute path (./tmp
, vs.,/full/path/to/tmp
).
I think you should be able to get coverage up without making these changes, one option would be just adding some ignore lines if necessary (since the logic is part of the setup of yargs, and not really part of the application logic).
175d031
to
ba0acbc
Compare
704bce3
to
fbe5d72
Compare
fbe5d72
to
0eef52a
Compare
refactor: bumping code coverage to 100% for lib/parse-args.js. (bcoe#447) test: Adding a test case for NODE_V8_COVERAGE and changing the describe block title. (bcoe#447) test: Ealry exit branch test for hideInstrumenteeArgs function. (bcoe#447) test: Adding test for relative paths for relative report directory cli option. (bcoe#447) test: Adding test case for relative paths for temporary directory cli option. (bcoe#447) test: Adding test for passing node.js arguments to c8. (bcoe#447)
0eef52a
to
692ec75
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.
Left a couple nits, I'd rather avoid changing behaviour around path resolution. The reason being that people have complicated setups with c8, where they run it in different directories, run it against output from web browsers (which may have files within them that are not relative to the director that c8 is running in, etc).
tldr; it might be okay to resolve
the reportsDir/tmpDir, but it may have unintended consequences upstream.
Perhaps I'm being too cautious, but I'd rather not change this part of the library (unless we're trying to address outstanding bugs, and have a regression test).
The issue of the check function mentioned above has come up a few times as I have been working on yargs related feature requests and code coverage reports. I outlined the issue as I saw it in #489. Furthermore, merging pull request #436 could change the delta of this pull request a fair amount. I suggest that I outline the various ways of setting the temp directory and then write unit tests against those scenarios. I think we can revisit this issue once these few dependencies are complete. |
refactor: bumping code coverage to 100% for lib/parse-args.js. (bcoe#447) test: Adding a test case for NODE_V8_COVERAGE and changing the describe block title. (bcoe#447) test: Ealry exit branch test for hideInstrumenteeArgs function. (bcoe#447) test: Adding test for relative paths for relative report directory cli option. (bcoe#447) test: Adding test case for relative paths for temporary directory cli option. (bcoe#447) test: Adding test for passing node.js arguments to c8. (bcoe#447)
692ec75
to
2c7bd7e
Compare
refactor: bumping code coverage to 100% for lib/parse-args.js. (bcoe#447) test: Adding a test case for NODE_V8_COVERAGE and changing the describe block title. (bcoe#447) test: Early exit branch test for hideInstrumenteeArgs function. (bcoe#447) test: Adding test for relative paths for relative report directory cli option. (bcoe#447) test: Adding test case for relative paths for temporary directory cli option. (bcoe#447) test: Adding test for passing node.js arguments to c8. (bcoe#447)
2c7bd7e
to
909e209
Compare
refactor: bumping code coverage to 100% for lib/parse-args.js. (bcoe#447) test: Adding a test case for NODE_V8_COVERAGE and changing the describe block title. (bcoe#447) test: Early exit branch test for hideInstrumenteeArgs function. (bcoe#447) test: Adding test for relative paths for relative report directory cli option. (bcoe#447) test: Adding test case for relative paths for temporary directory cli option. (bcoe#447) test: Adding test for passing node.js arguments to c8. (bcoe#447)
909e209
to
04b0e61
Compare
refactor: bumping code coverage to 100% for lib/parse-args.js. (bcoe#447) test: Adding a test case for NODE_V8_COVERAGE and changing the describe block title. (bcoe#447) test: Early exit branch test for hideInstrumenteeArgs function. (bcoe#447) test: Adding test for relative paths for relative report directory cli option. (bcoe#447) test: Adding test case for relative paths for temporary directory cli option. (bcoe#447) test: Adding test for passing node.js arguments to c8. (bcoe#447)
04b0e61
to
80fe2ac
Compare
refactor: bumping code coverage to 100% for lib/parse-args.js. (bcoe#447) test: Adding a test case for NODE_V8_COVERAGE and changing the describe block title. (bcoe#447) test: Early exit branch test for hideInstrumenteeArgs function. (bcoe#447) test: Adding test for relative paths for relative report directory cli option. (bcoe#447) test: Adding test case for relative paths for temporary directory cli option. (bcoe#447) test: Adding test for passing node.js arguments to c8. (bcoe#447) test: relative directories for tempDirectoy and reportDir
80fe2ac
to
eada810
Compare
refactor: bumping code coverage to 100% for lib/parse-args.js. (bcoe#447) test: Adding a test case for NODE_V8_COVERAGE and changing the describe block title. (bcoe#447) test: Early exit branch test for hideInstrumenteeArgs function. (bcoe#447) test: Adding test for relative paths for relative report directory cli option. (bcoe#447) test: Adding test case for relative paths for temporary directory cli option. (bcoe#447) test: Adding test for passing node.js arguments to c8. (bcoe#447) test: relative directories for tempDirectoy and reportDir
eada810
to
977cead
Compare
refactor: bumping code coverage to 100% for lib/parse-args.js. (bcoe#447) test: Adding a test case for NODE_V8_COVERAGE and changing the describe block title. (bcoe#447) test: Early exit branch test for hideInstrumenteeArgs function. (bcoe#447) test: Adding test for relative paths for relative report directory cli option. (bcoe#447) test: Adding test case for relative paths for temporary directory cli option. (bcoe#447) test: Adding test for passing node.js arguments to c8. (bcoe#447) test: relative directories for tempDirectoy and reportDir
977cead
to
5ca85f9
Compare
refactor: bumping code coverage to 100% for lib/parse-args.js. (bcoe#447) test: Adding a test case for NODE_V8_COVERAGE and changing the describe block title. (bcoe#447) test: Early exit branch test for hideInstrumenteeArgs function. (bcoe#447) test: Adding test for relative paths for relative report directory cli option. (bcoe#447) test: Adding test case for relative paths for temporary directory cli option. (bcoe#447) test: Adding test for passing node.js arguments to c8. (bcoe#447) test: relative directories for tempDirectoy and reportDir
5ca85f9
to
7e61196
Compare
refactor: bumping code coverage to 100% for lib/parse-args.js. (bcoe#447) test: Adding a test case for NODE_V8_COVERAGE and changing the describe block title. (bcoe#447) test: Early exit branch test for hideInstrumenteeArgs function. (bcoe#447) test: Adding test for relative paths for relative report directory cli option. (bcoe#447) test: Adding test case for relative paths for temporary directory cli option. (bcoe#447) test: Adding test for passing node.js arguments to c8. (bcoe#447) test: relative directories for tempDirectoy and reportDir
7e61196
to
29d3e1a
Compare
refactor: bumping code coverage to 100% for lib/parse-args.js. (bcoe#447) test: Adding a test case for NODE_V8_COVERAGE and changing the describe block title. (bcoe#447) test: Early exit branch test for hideInstrumenteeArgs function. (bcoe#447) test: Adding test for relative paths for relative report directory cli option. (bcoe#447) test: Adding test case for relative paths for temporary directory cli option. (bcoe#447) test: Adding test for passing node.js arguments to c8. (bcoe#447) test: relative directories for tempDirectoy and reportDir
29d3e1a
to
ba84f60
Compare
refactor: bumping code coverage to 100% for lib/parse-args.js. (bcoe#447) test: Adding a test case for NODE_V8_COVERAGE and changing the describe block title. (bcoe#447) test: Early exit branch test for hideInstrumenteeArgs function. (bcoe#447) test: Adding test for relative paths for relative report directory cli option. (bcoe#447) test: Adding test case for relative paths for temporary directory cli option. (bcoe#447) test: Adding test for passing node.js arguments to c8. (bcoe#447)
92d9ab4
to
2c5f1b2
Compare
refactor: removing / testing lines of code for lib/parse-args.js to increase coverage. (bcoe#447) test: Adding a test case for NODE_V8_COVERAGE and changing the describe block title. (bcoe#447) test: Early exit branch test for hideInstrumenteeArgs function. (bcoe#447) test: Adding test for relative paths for relative report directory cli option. (bcoe#447) test: Adding test case for relative paths for temporary directory cli option. (bcoe#447) test: Adding test for passing node.js arguments to c8. (bcoe#447)
2c5f1b2
to
dcd63a5
Compare
/** Commenting out till the print config PR is ready * / | ||
it('should set it if undefined', () => { | ||
const NODE_V8_COVERAGE = process.env.NODE_V8_COVERAGE | ||
process.env.NODE_V8_COVERAGE = undefined | ||
process.argv = ['node', 'c8', '--foo=99', 'my-app', '--help'] | ||
const argv = buildYargs().parse(hideInstrumenteeArgs()) | ||
argv.tempDirectory.endsWith('/coverage/tmp').should.be.equal(true) | ||
delete process.env.NODE_V8_COVERAGE | ||
process.env.NODE_V8_COVERAGE = 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.
Another candidate for updating unit tests as it relates to (#516)
/** Commenting out till the print config PR is ready * / | ||
it('should set it if undefined', () => { | ||
const NODE_V8_COVERAGE = process.env.NODE_V8_COVERAGE | ||
process.env.NODE_V8_COVERAGE = undefined | ||
process.argv = ['node', 'c8', '--foo=99', 'my-app', '--help'] | ||
const argv = buildYargs().parse(hideInstrumenteeArgs()) | ||
argv.tempDirectory.endsWith('/coverage/tmp').should.be.equal(true) | ||
delete process.env.NODE_V8_COVERAGE | ||
process.env.NODE_V8_COVERAGE = 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.
Need to uncomment and skip this test.
refactor: removing / testing lines of code for lib/parse-args.js to increase coverage. (bcoe#447) test: Adding a test case for NODE_V8_COVERAGE and changing the describe block title. (bcoe#447) test: Early exit branch test for hideInstrumenteeArgs function. (bcoe#447) test: Adding test for relative paths for relative report directory cli option. (bcoe#447) test: Adding test case for relative paths for temporary directory cli option. (bcoe#447) test: Adding test for passing node.js arguments to c8. (bcoe#447)
Pull Request 447
Increase code quality by increasing code coverage: lib/parse-args.js
refactor: bumping code coverage to 100% for lib/parse-args.js. (#447)
test: Adding a test case for NODE_V8_COVERAGE and changing the describe block title. (#447)
test: Early exit branch test for hideInstrumenteeArgs function. (#447)
test: Adding test for relative paths for relative report directory cli option. (#447)
test: Adding test case for relative paths for temporary directory cli option. (#447)
test: Adding test for passing node.js arguments to c8. (#447)
Following the Contributions Recommendations here.
File Code Coverage Matrix Report
Unit Tests Results
All tests run on Node version 18.19.0
Node Version Testing Matrix
Referencing Issue #448
Updated 2023-07-29 7:59 PM EST
Updated 2023-07-30 11:25 AM EST
Updated 2024-01-14 9:03 PM EST