Improve code quality by increasing code coverage: lib/source-map-from-file.js
Pull Request 453
commit ff5d39b73f2265105a8ecf1cc4b5fd9f47a570e2 Author: The Nasty [email protected] Date: Tue Jan 16 14:00:38 2024 -0500
Improve code quality by increasing code coverage: lib/source-map-from-file.js (#453)
refactor: lib/source-map-from-file.js to improve code coverage (#453)
refactor: exposed source-map-from-file.js function to write test cases (#453)
test: Added two test case cases to cover error handling for improper formatting (#453)
Following the Contributions Recommendations here.
- [x] Make sure you have installed the latest version of Node.js
- [x] Fork this project on GitHub and clone your fork locally
- [x] Create local branches to work within. These should also be created directly from the main branch. Local Fork here.
- [x] Make your changes.
- [x] Run tests to make sure all is okay (everything should pass except the snapshot).
- A complete log of initial test results.
- As instructed, ignore snapshot failures. 0 failures
- 101 passing in 1 minutes
- [x] Now update the snapshot.
- A complete log of snapshot test results.
- 101 passing in 1 minutes
- [x] If all is passing, commit your changes. The log of the commit can be found here.
- [x] As a best practice, once you have committed your changes, it is a good idea to use git rebase (not git merge) to synchronize your work with the main repository.
- [x] Run tests again to make sure all is okay.
- A complete log of the final test results.
- 101 passing in 49 seconds
- [x] Push
- [x] Open the pull request, see details in the template.
- [ ] Make any necessary changes after review.
File Code Coverage Matrix Report
| Test Type | File | Statement | Branch | Function | Lines | PASS |
|---|---|---|---|---|---|---|
| Final Test | lib/source-map-from-file.js | 100% | 93.33% | 100% | 100% | :x: |
| Node 14.21.3 | lib/source-map-from-file.js | 100% | 93.33% | 100% | 100% | :x: |
| Node 16.20.2 | lib/source-map-from-file.js | 100% | 93.33% | 100% | 100% | :x: |
| Node 18.19.0 | lib/source-map-from-file.js | 100% | 93.33% | 100% | 100% | :x: |
| Node 20.11.0 | lib/source-map-from-file.js | 100% | 93.33% | 100% | 100% | :x: |
Unit Tests Results
| Test Type | PASS | Tests Passed | Tests Failed | Time |
|---|---|---|---|---|
| Initial Test | :heavy_check_mark: | 101 passing | 0 failures | 1 minutes |
| Snapshot Test | :heavy_check_mark: | 101 passing | 0 failures | 1 minutes |
| Final Test | :heavy_check_mark: | 101 passing | 0 failures | 49 seconds |
- Tests conducted with Node v18.19.0
Node Version Testing Matrix
| Node Version | PASS | Tests Passed | Tests Failed | Time |
|---|---|---|---|---|
| 14.21.3 | :heavy_check_mark: | 101 passing | 0 failures | 1 minutes |
| 16.20.2 | :heavy_check_mark: | 101 passing | 0 failures | 58 seconds |
| 18.19.0 | :heavy_check_mark: | 101 passing | 0 failures | 60 seconds |
| 20.11.0 | :heavy_check_mark: | 101 passing | 0 failures | 59 seconds |
References #448
- Updated 2024-01-16 4:39 PM EST
This looks ready to land to me, apologies for ignoring for so long.
Mind rebasing?
@bcoe ready to go!
Completed another rebase after release.
Everything looks good except the tests on node 14. The CI process fails with the following error:
Run npm ci --engine-strict
npm ERR! Cannot read property '@bcoe/v8-coverage' of undefined
npm ERR! A complete log of this run can be found in:
npm ERR! /home/runner/.npm/_logs/202[4](https://github.com/bcoe/c8/actions/runs/7415825716/job/20179695732?pr=453#step:4:5)-01-04T23_0[7](https://github.com/bcoe/c8/actions/runs/7415825716/job/20179695732?pr=453#step:4:8)_00_[8](https://github.com/bcoe/c8/actions/runs/7415825716/job/20179695732?pr=453#step:4:9)93Z-debug.log
Error: Process completed with exit code 1.
If I run the same command locally on Node 14, I get the following:
❯ sh
$ node -v
v14.21.3
$ npm ci --engine-strict
added 384 packages, and audited 385 packages in 7s
99 packages are looking for funding
run `npm fund` for details
found 0 vulnerabilities
$ uname -a
Linux XXXX-XXXXXX 5.15.133.1-microsoft-standard-WSL2 #1 SMP Thu Oct 5 21:02:42 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
$
I don't think this is anything on my end. @bcoe any ideas?
I am going to pull this back into draft mode. I noticed another module for spies that looks much easier to implement.