Skip to content

Commit

Permalink
fix: remote test coverage map
Browse files Browse the repository at this point in the history
Turns out there were three files that still had no test coverage because
of the combination of the mocks in tests and the coverage map.  Removing
the map altogether exposed them.  One of them was easy enough to cover
with some differing tar sizes in the `npm view` tests.  The others will
be more complicated and will need a future effort.  This PR removes the
coverage map, and specifically ignores the one directory that doesn't
have coverage right now.  Fixing that still needs to happen, but we're
no worse off now than we were before, and now we have a specific signal
that those files have no coverage (the nyc-arg entry in package.json)
rather than them being silently ignored.

The `npm view` tests were also refactored to use the real npm object.
  • Loading branch information
wraithgar committed May 5, 2022
1 parent 8e7ea9b commit 9be58d5
Show file tree
Hide file tree
Showing 6 changed files with 381 additions and 503 deletions.
3 changes: 0 additions & 3 deletions lib/commands/view.js
Expand Up @@ -57,9 +57,6 @@ class View extends BaseCommand {

function getFields (d, f, pref) {
f = f || []
if (!d) {
return f
}
pref = pref || []
Object.keys(d).forEach((k) => {
if (k.charAt(0) === '_' || k.indexOf('.') !== -1) {
Expand Down
1 change: 1 addition & 0 deletions lib/utils/format-bytes.js
Expand Up @@ -23,6 +23,7 @@ const formatBytes = (bytes, space = true) => {
return `${(bytes / 1000000).toFixed(1)}${spacer}MB`
}

// GB
return `${(bytes / 1000000000).toFixed(1)}${spacer}GB`
}

Expand Down
11 changes: 9 additions & 2 deletions package.json
Expand Up @@ -230,8 +230,15 @@
],
"color": 1,
"files": "test/{lib,bin,index.js}",
"coverage-map": "test/coverage-map.js",
"timeout": 600
"timeout": 600,
"nyc-arg": [
"--exclude",
"lib/search/**",
"--exclude",
"workspaces/**",
"--exclude",
"tap-snapshots/**"
]
},
"templateOSS": {
"rootRepo": false,
Expand Down

0 comments on commit 9be58d5

Please sign in to comment.