Skip to content

Commit 2372c03

Browse files
committed
chore: use c8 ignore statements where possible
1 parent bd1bf3c commit 2372c03

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+117
-78
lines changed

lib/base-cmd.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,11 @@ class BaseCommand {
3131
let results = ''
3232
let line = ''
3333
for (const param of params) {
34-
/* istanbul ignore next */
34+
/* c8 ignore start */
3535
if (seenExclusive.has(param)) {
3636
continue
3737
}
38+
/* c8 ignore stop */
3839
const { exclusive } = definitions[param]
3940
let paramUsage = `${definitions[param].usage}`
4041
if (exclusive) {

lib/cli.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
try {
22
const { enableCompileCache } = require('node:module')
3-
/* istanbul ignore next */
3+
/* c8 ignore start */
44
if (enableCompileCache) {
55
enableCompileCache()
66
}
7-
} catch (e) { /* istanbul ignore next */ }
7+
/* c8 ignore stop */
8+
} catch (e) { /* c8 ignore next */ }
89

910
const validateEngines = require('./cli/validate-engines.js')
1011
const cliEntry = require('node:path').resolve(__dirname, 'cli/entry.js')

lib/cli/validate-engines.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ module.exports = (process, getCli) => {
1717

1818
// coverage ignored because this is only hit in very unsupported node versions
1919
// and it's a best effort attempt to show something nice in those cases
20-
/* istanbul ignore next */
20+
/* c8 ignore start */
2121
const syntaxErrorHandler = (err) => {
2222
if (err instanceof SyntaxError) {
2323
// eslint-disable-next-line no-console
@@ -28,6 +28,7 @@ module.exports = (process, getCli) => {
2828
}
2929
throw err
3030
}
31+
/* c8 ignore stop */
3132

3233
process.on('uncaughtException', syntaxErrorHandler)
3334
process.on('unhandledRejection', syntaxErrorHandler)

lib/commands/completion.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -212,8 +212,7 @@ const dumpScript = async (p) => {
212212
// errors, so casually. But, without this, `. <(npm completion)`
213213
// can never ever work on OS X.
214214
// TODO Ignoring coverage, see 'non EPIPE errors cause failures' test.
215-
/* istanbul ignore next */
216-
if (er.errno === 'EPIPE') {
215+
if (er.errno === 'EPIPE') /* c8 ignore next */ {
217216
res()
218217
} else {
219218
rej(er)

lib/commands/config.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -290,10 +290,11 @@ ${defData}
290290
return // if validate doesn't throw we have nothing to do
291291
} catch (err) {
292292
// coverage skipped because we don't need to test rethrowing errors
293-
// istanbul ignore next
293+
/* c8 ignore start */
294294
if (err.code !== 'ERR_INVALID_AUTH') {
295295
throw err
296296
}
297+
/* c8 ignore stop */
297298

298299
problems = err.problems
299300
}
@@ -310,12 +311,11 @@ ${defData}
310311
output.standard('The following configuration problems have been repaired:\n')
311312
const summary = problems.map(({ action, from, to, key, where }) => {
312313
// coverage disabled for else branch because it is intentionally omitted
313-
// istanbul ignore else
314314
if (action === 'rename') {
315315
// we keep track of which configs were modified here so we know what to save later
316316
locations.push(where)
317317
return `~ \`${from}\` renamed to \`${to}\` in ${where} config`
318-
} else if (action === 'delete') {
318+
} /* c8 ignore next */ else if (action === 'delete') {
319319
locations.push(where)
320320
return `- \`${key}\` deleted from ${where} config`
321321
}

lib/commands/edit.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,11 @@ class Edit extends BaseCommand {
3434
static ignoreImplicitWorkspace = false
3535

3636
// TODO
37-
/* istanbul ignore next */
37+
/* c8 ignore start */
3838
static async completion (opts, npm) {
3939
return completion(npm, opts)
4040
}
41+
/* c8 ignore stop */
4142

4243
async exec (args) {
4344
if (args.length !== 1) {

lib/commands/explain.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,12 @@ class Explain extends ArboristWorkspaceCmd {
1818
static ignoreImplicitWorkspace = false
1919

2020
// TODO
21-
/* istanbul ignore next */
21+
/* c8 ignore start */
2222
static async completion (opts, npm) {
2323
const completion = require('../utils/installed-deep.js')
2424
return completion(npm, opts)
2525
}
26+
/* c8 ignore stop */
2627

2728
async exec (args) {
2829
if (!args.length) {

lib/commands/explore.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,11 @@ class Explore extends BaseCommand {
1515
static ignoreImplicitWorkspace = false
1616

1717
// TODO
18-
/* istanbul ignore next */
18+
/* c8 ignore start */
1919
static async completion (opts, npm) {
2020
return completion(npm, opts)
2121
}
22+
/* c8 ignore stop */
2223

2324
async exec (args) {
2425
if (args.length < 1 || !args[0]) {

lib/commands/fund.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,12 @@ class Fund extends ArboristWorkspaceCmd {
3535
}
3636

3737
// TODO
38-
/* istanbul ignore next */
38+
/* c8 ignore start */
3939
static async completion (opts, npm) {
4040
const completion = require('../utils/installed-deep.js')
4141
return completion(npm, opts)
4242
}
43+
/* c8 ignore stop */
4344

4445
async exec (args) {
4546
const spec = args[0]

lib/commands/get.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,12 @@ class Get extends BaseCommand {
99
static ignoreImplicitWorkspace = false
1010

1111
// TODO
12-
/* istanbul ignore next */
12+
/* c8 ignore start */
1313
static async completion (opts) {
1414
const Config = Npm.cmd('config')
1515
return Config.completion(opts)
1616
}
17+
/* c8 ignore stop */
1718

1819
async exec (args) {
1920
return this.npm.exec('config', ['get'].concat(args))

0 commit comments

Comments
 (0)