c8 icon indicating copy to clipboard operation
c8 copied to clipboard

Improve code quality by increasing code coverage: lib/source-map-from-file.js

Open mcknasty opened this issue 2 years ago • 5 comments

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.

  1. [x] Make sure you have installed the latest version of Node.js
  2. [x] Fork this project on GitHub and clone your fork locally
  3. [x] Create local branches to work within. These should also be created directly from the main branch. Local Fork here.
  4. [x] Make your changes.
  5. [x] Run tests to make sure all is okay (everything should pass except the snapshot).
    1. A complete log of initial test results.
    2. As instructed, ignore snapshot failures. 0 failures
    3. 101 passing in 1 minutes
  6. [x] Now update the snapshot.
    1. A complete log of snapshot test results.
    2. 101 passing in 1 minutes
  7. [x] If all is passing, commit your changes. The log of the commit can be found here.
  8. [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.
  9. [x] Run tests again to make sure all is okay.
    1. A complete log of the final test results.
    2. 101 passing in 49 seconds
  10. [x] Push
  11. [x] Open the pull request, see details in the template.
  12. [ ] 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

mcknasty avatar Feb 10 '23 00:02 mcknasty

This looks ready to land to me, apologies for ignoring for so long.

Mind rebasing?

bcoe avatar Jan 03 '24 17:01 bcoe

@bcoe ready to go!

mcknasty avatar Jan 03 '24 21:01 mcknasty

Completed another rebase after release.

mcknasty avatar Jan 04 '24 23:01 mcknasty

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?

mcknasty avatar Jan 05 '24 00:01 mcknasty

I am going to pull this back into draft mode. I noticed another module for spies that looks much easier to implement.

mcknasty avatar Jan 20 '24 20:01 mcknasty