Skip to content

Commit

Permalink
fix: remove tap 16 specific config when using tap 18
Browse files Browse the repository at this point in the history
  • Loading branch information
lukekarrys committed Nov 15, 2023
1 parent 17ea62d commit 74331b4
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 2 deletions.
3 changes: 3 additions & 0 deletions lib/config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
const { relative, dirname, join, extname } = require('path')
const { defaults, defaultsDeep, pick, omit, uniq, isPlainObject } = require('lodash')
const semver = require('semver')
const ciVersions = require('./util/ci-versions.js')
const parseDependabot = require('./util/dependabot.js')
const git = require('./util/git.js')
Expand Down Expand Up @@ -165,6 +166,8 @@ const getFullConfig = async ({
esm,
cjsExt: esm ? 'cjs' : 'js',
deleteJsExt: esm ? 'js' : 'cjs',
// tap
tap18: semver.coerce(pkg.pkgJson?.devDependencies?.tap)?.major === 18,
// booleans to control application of updates
isForce,
isDogFood,
Expand Down
4 changes: 2 additions & 2 deletions lib/content/package-json.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,13 @@
{{#if workspacePaths}}
"test-ignore": "^({{ join workspacePaths "|" }})/",
{{/if}}
"nyc-arg": [
"nyc-arg": {{#if tap18}}{{{ del }}}{{else}}[
{{#each workspaceGlobs}}
"--exclude",
"{{ . }}",
{{/each}}
"--exclude",
"tap-snapshots/**"
]
]{{/if}}
}
}
37 changes: 37 additions & 0 deletions test/apply/tap.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
const t = require('tap')
const setup = require('../setup.js')

t.test('tap@18', async (t) => {
const s = await setup(t, {
ok: true,
package: {
devDependencies: {
tap: '^18',
},
},
})

await s.apply()
const pkg = await s.readJson('package.json')
t.strictSame(pkg.tap, {})
})

t.test('tap@16', async (t) => {
const s = await setup(t, {
ok: true,
package: {
devDependencies: {
tap: '^16',
},
},
})

await s.apply()
const pkg = await s.readJson('package.json')
t.strictSame(pkg.tap, {
'nyc-arg': [
'--exclude',
'tap-snapshots/**',
],
})
})

0 comments on commit 74331b4

Please sign in to comment.