Skip to content

Commit 6921209

Browse files
committed
chore: adds ignores in c8 style
1 parent 2372c03 commit 6921209

File tree

13 files changed

+31
-11
lines changed

13 files changed

+31
-11
lines changed

docs/bin/build.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@ const { paths } = require('../lib/index')
33

44
run(paths)
55
.then((res) => console.error(`Wrote ${res.length} files`))
6+
/* c8 ignore start - covered in istanbul not not in the c8 swap */
67
.catch((err) => {
78
process.exitCode = 1
89
console.error(err)
910
})
11+
/* c8 ignore stop */

docs/lib/check-nav.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,10 @@ function ensureNavigationComplete (nav, fsPaths, ext) {
1717
// otherwise its unmarked in the nav
1818
if (unmatchedFs[key]) {
1919
delete unmatchedFs[key]
20-
} else {
20+
} /* c8 ignore start - covered in istanbul not not in the c8 swap */ else {
2121
unmatchedNav[key] = true
2222
}
23+
/* c8 ignore stop */
2324
}
2425

2526
const toKeys = (v) => Object.keys(v).sort().map((p) => p.split(posix.sep).join(sep))
@@ -28,6 +29,7 @@ function ensureNavigationComplete (nav, fsPaths, ext) {
2829

2930
const errors = []
3031

32+
/* c8 ignore start - covered in istanbul not not in the c8 swap */
3133
if (missingNav.length) {
3234
errors.push('The following path(s) exist on disk but are not present in /lib/content/nav.yml:')
3335
errors.push(...missingNav.map(n => ` ${n}`))
@@ -43,6 +45,7 @@ function ensureNavigationComplete (nav, fsPaths, ext) {
4345
errors.push('Update nav.yml to ensure that all files are listed in the appropriate place.')
4446
throw new Error(errors.join('\n'))
4547
}
48+
/* c8 ignore stop */
4649
}
4750

4851
function getNavigationPaths (entries) {

docs/lib/index.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,13 @@ const TAGS = {
1414
}
1515

1616
const assertPlaceholder = (src, path, placeholder) => {
17+
/* c8 ignore start - covered in istanbul not not in the c8 swap */
1718
if (!src.includes(placeholder)) {
1819
throw new Error(
1920
`Cannot replace ${placeholder} in ${path} due to missing placeholder`
2021
)
2122
}
23+
/* c8 ignore stop */
2224
return placeholder
2325
}
2426

docs/lib/transform-html.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,10 @@ function transformHTML (
4040
case 'version':
4141
return version
4242

43+
/* c8 ignore start - covered in istanbul not not in the c8 swap */
4344
default:
4445
throw new Error(`warning: unknown token '${token}' in ${path}`)
46+
/* c8 ignore stop */
4547
}
4648
})
4749

@@ -62,7 +64,7 @@ function transformHTML (
6264

6365
if (url.startsWith('/')) {
6466
const childDepth = path.split('/').length - 1
65-
const prefix = childDepth > 0 ? '../'.repeat(childDepth) : './'
67+
const prefix = childDepth > 0 ? '../'.repeat(childDepth) : /* c8 ignore start - covered in istanbul not not in the c8 swap */ './' /* c8 ignore stop */
6668

6769
url = url.replace(/^\//, prefix)
6870

lib/commands/completion.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,9 +163,10 @@ class Completion extends BaseCommand {
163163
const comps = await completion(opts, this.npm)
164164
return this.wrap(opts, comps)
165165
}
166-
} catch {
166+
} /* c8 ignore start - covered in istanbul not not in the c8 swap */ catch {
167167
// it wasnt a valid command, so do nothing
168168
}
169+
/* c8 ignore stop */
169170
}
170171

171172
// The command should respond with an array. Loop over that,
@@ -214,9 +215,10 @@ const dumpScript = async (p) => {
214215
// TODO Ignoring coverage, see 'non EPIPE errors cause failures' test.
215216
if (er.errno === 'EPIPE') /* c8 ignore next */ {
216217
res()
217-
} else {
218+
} /* c8 ignore start - covered in istanbul not not in the c8 swap */ else {
218219
rej(er)
219220
}
221+
/* c8 ignore stop */
220222
})
221223

222224
process.stdout.write(d, () => {

lib/commands/config.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,11 +57,13 @@ const isProtected = (k) => {
5757
}
5858
// //registry:_authToken or //registry:authToken
5959
for (const p of protected) {
60-
if (k.endsWith(`:${p}`) || k.endsWith(`:_${p}`)) {
60+
if (k.endsWith(`:${p}`) || /* c8 ignore start - covered in istanbul not not in the c8 swap */ k.endsWith(`:_${p}`) /* c8 ignore stop */) {
6161
return true
6262
}
6363
}
64+
/* c8 ignore start - covered in istanbul not not in the c8 swap */
6465
}
66+
/* c8 ignore stop */
6567
return false
6668
}
6769

lib/commands/diff.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,9 @@ class Diff extends BaseCommand {
177177
for (const edge of node.edgesIn) {
178178
return edge.spec
179179
}
180+
/* c8 ignore start - covered in istanbul not not in the c8 swap */
180181
}
182+
/* c8 ignore stop */
181183

182184
const aSpec = `file:${node.realpath}`
183185

lib/commands/fund.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,9 @@ class Fund extends ArboristWorkspaceCmd {
167167
return item.package
168168
}
169169
}
170+
/* c8 ignore start - covered in istanbul not not in the c8 swap */
170171
}
172+
/* c8 ignore stop */
171173
} else {
172174
// tries to retrieve a package from arborist inventory
173175
// by matching resulted package name from the provided spec

lib/commands/link.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,9 +165,10 @@ class Link extends ArboristWorkspaceCmd {
165165
// TODO: write tests for unmatching version specs, this is hard to test
166166
// atm but should be simple once we have a mocked registry again
167167
if (arg.name !== node.name /* c8 ignore next */ || (
168+
/* c8 ignore start - covered in istanbul not not in the c8 swap */
168169
arg.version &&
169-
/* c8 ignore next */
170170
!semver.satisfies(node.version, arg.version)
171+
/* c8 ignore stop */
171172
)) {
172173
foundNodes.push(node)
173174
return true

lib/commands/star.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,9 @@ class Star extends BaseCommand {
6666
log.verbose('star', data)
6767
return data
6868
}
69+
/* c8 ignore start - covered in istanbul not not in the c8 swap */
6970
}
71+
/* c8 ignore stop */
7072
}
7173

7274
module.exports = Star

0 commit comments

Comments
 (0)