Skip to content

Commit 74331b4

Browse files
committed
fix: remove tap 16 specific config when using tap 18
1 parent 17ea62d commit 74331b4

File tree

3 files changed

+42
-2
lines changed

3 files changed

+42
-2
lines changed

lib/config.js

+3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
const { relative, dirname, join, extname } = require('path')
22
const { defaults, defaultsDeep, pick, omit, uniq, isPlainObject } = require('lodash')
3+
const semver = require('semver')
34
const ciVersions = require('./util/ci-versions.js')
45
const parseDependabot = require('./util/dependabot.js')
56
const git = require('./util/git.js')
@@ -165,6 +166,8 @@ const getFullConfig = async ({
165166
esm,
166167
cjsExt: esm ? 'cjs' : 'js',
167168
deleteJsExt: esm ? 'js' : 'cjs',
169+
// tap
170+
tap18: semver.coerce(pkg.pkgJson?.devDependencies?.tap)?.major === 18,
168171
// booleans to control application of updates
169172
isForce,
170173
isDogFood,

lib/content/package-json.hbs

+2-2
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,13 @@
3434
{{#if workspacePaths}}
3535
"test-ignore": "^({{ join workspacePaths "|" }})/",
3636
{{/if}}
37-
"nyc-arg": [
37+
"nyc-arg": {{#if tap18}}{{{ del }}}{{else}}[
3838
{{#each workspaceGlobs}}
3939
"--exclude",
4040
"{{ . }}",
4141
{{/each}}
4242
"--exclude",
4343
"tap-snapshots/**"
44-
]
44+
]{{/if}}
4545
}
4646
}

test/apply/tap.js

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
const t = require('tap')
2+
const setup = require('../setup.js')
3+
4+
t.test('tap@18', async (t) => {
5+
const s = await setup(t, {
6+
ok: true,
7+
package: {
8+
devDependencies: {
9+
tap: '^18',
10+
},
11+
},
12+
})
13+
14+
await s.apply()
15+
const pkg = await s.readJson('package.json')
16+
t.strictSame(pkg.tap, {})
17+
})
18+
19+
t.test('tap@16', async (t) => {
20+
const s = await setup(t, {
21+
ok: true,
22+
package: {
23+
devDependencies: {
24+
tap: '^16',
25+
},
26+
},
27+
})
28+
29+
await s.apply()
30+
const pkg = await s.readJson('package.json')
31+
t.strictSame(pkg.tap, {
32+
'nyc-arg': [
33+
'--exclude',
34+
'tap-snapshots/**',
35+
],
36+
})
37+
})

0 commit comments

Comments
 (0)