Skip to content

Commit 83c0c7d

Browse files
authored
Resurfaces an old PR that updated tap 16 -> 19 (still not sure what's needed from that until i see the diff. Had to do some googling to find why `/* istanbul ignore next */` doesn't work anymore. tapjs/tapjs#1027 got some node 22 failures - ENOENT: no such file or directory, open '/home/runner/work/template-oss/template-oss/.tap/fixtures/test-apply-esm.js-basic/file.js' doesn't work on 20.5.0 because of tapjs/tapjs#1028
1 parent 402d480 commit 83c0c7d

25 files changed

+98
-67
lines changed

lib/content/package-json.hbs

+12
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,24 @@
4040
},
4141
"templateVersion": {{{ del }}},
4242
"standard": {{{ del }}},
43+
"nyc": {{#if tap18}}{
44+
"exclude": {{{ json workspaceGlobs }}}
45+
}{{else}}{{{ del }}}{{/if}},
4346
"tap": {
47+
{{#if tap18}}
48+
{{#if workspaceGlobs}}
49+
"exclude": {{{ json workspaceGlobs }}},
50+
{{/if}}
51+
"test-ignore": {{{ del }}},
52+
{{else}}
53+
"exclude": {{{ del }}},
4454
{{#if workspacePaths}}
4555
"exclude": {{#if tap18}}[
4656
"{{ join workspaceGlobs "," }}"
4757
]{{else }}{{{ del }}}{{/if}},
4858
"test-ignore": {{#if tap18}}{{{ del }}}{{else}}"^({{ join workspacePaths "|" }})/"{{/if}},
4959
{{/if}}
60+
{{/if}}
5061
{{#if typescript}}
5162
{{#if tap16}}
5263
"coverage": false,
@@ -57,6 +68,7 @@
5768
],
5869
{{/if}}
5970
{{/if}}
71+
"show-full-coverage": {{#if tap18}}true{{else}}{{{ del }}}{{/if}},
6072
"nyc-arg": {{#if tap18}}{{{ del }}}{{else}}[
6173
{{#each workspaceGlobs}}
6274
"--exclude",

lib/release/node-workspace-format.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ const { TagName } = require('release-please/build/src/util/tag-name.js')
55
const { ROOT_PROJECT_PATH } = require('release-please/build/src/manifest.js')
66
const { DEPS, link, wrapSpecs, list } = require('./util.js')
77

8-
/* istanbul ignore next: TODO fix flaky tests and enable coverage */
8+
/* TODO fix flaky tests and enable coverage */
9+
/* c8 ignore start */
910
module.exports = class extends ManifestPlugin {
1011
static WORKSPACE_MESSAGE = (name, version) => `${DEPS}(workspace): ${name}@${version}`
1112

@@ -95,3 +96,4 @@ module.exports = class extends ManifestPlugin {
9596
}
9697
}
9798
}
99+
/* c8 ignore end */

lib/release/release-manager.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -165,13 +165,14 @@ class ReleaseManager {
165165
// If the url fails with anything but a 404 we want the process to blow
166166
// up because that means something is very wrong. This is a rare edge
167167
// case that isn't worth testing.
168-
/* istanbul ignore else */
168+
169169
if (r.statusCode === 200) {
170170
this.#info('Found release process from wiki')
171171
return r.body.text()
172172
} else if (r.statusCode === 404) {
173173
this.#info('No release process found in wiki, falling back to default process')
174174
return this.#getReleaseSteps()
175+
/* c8 ignore next 3 */
175176
} else {
176177
throw new Error(`Release process fetch failed with status: ${r.statusCode}`)
177178
}

lib/release/release-please.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ const NodeWorkspaceFormat = require('./node-workspace-format.js')
99
const { getPublishTag, noop } = require('./util.js')
1010
const { SemverVersioningStrategy } = require('./semver-versioning-strategy.js')
1111

12-
/* istanbul ignore next: TODO fix flaky tests and enable coverage */
12+
/* TODO fix flaky tests and enable coverage */
13+
/* c8 ignore start */
1314
class ReleasePlease {
1415
#token
1516
#owner
@@ -163,5 +164,6 @@ class ReleasePlease {
163164
return releases.length ? releases : null
164165
}
165166
}
167+
/* c8 ignore end */
166168

167169
module.exports = ReleasePlease

lib/release/semver-versioning-strategy.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,11 @@ class SemverVersioningStrategy {
5959
const releaseType = parseCommits(commits)
6060
const addPreIfNeeded = prerelease ? `pre${releaseType}` : releaseType
6161
const version = inc(currentVersion.toString(), addPreIfNeeded, tag)
62-
/* istanbul ignore next */
62+
/* c8 ignore start */
6363
if (!version) {
6464
throw new Error('Could not bump version')
6565
}
66+
/* c8 ignore stop */
6667
return Version.parse(version)
6768
}
6869
}

lib/util/import-or-require.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@ const importOrRequire = async path => {
1515
try {
1616
content = require(path)
1717
// this is for node 22+
18-
// istanbul ignore next
18+
/* c8 ignore start */
1919
if (content.__esModule) {
2020
return content.default
2121
}
22+
/* c8 ignore end */
2223
} catch {
23-
// istanbul ignore next
2424
try {
2525
// this is for node under 20
2626
const results = await import(pathToFileURL(path))

package.json

+12-10
Original file line numberDiff line numberDiff line change
@@ -73,20 +73,17 @@
7373
"eslint-config-prettier": "^9.1.0",
7474
"nock": "^13.3.8",
7575
"prettier": "^3.2.5",
76-
"tap": "^16.0.0"
76+
"tap": "^21.0.1"
7777
},
7878
"tap": {
7979
"timeout": 600,
80-
"nyc-arg": [
81-
"--exclude",
82-
"workspace/test-workspace/**",
83-
"--exclude",
84-
"tap-snapshots/**"
85-
],
86-
"test-ignore": "^(workspace/test-workspace)/",
8780
"node-arg": [
8881
"--no-experimental-fetch"
89-
]
82+
],
83+
"exclude": [
84+
"workspace/test-workspace/**"
85+
],
86+
"show-full-coverage": true
9087
},
9188
"templateOSS": {
9289
"//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.",
@@ -98,5 +95,10 @@
9895
},
9996
"workspaces": [
10097
"workspace/test-workspace"
101-
]
98+
],
99+
"nyc": {
100+
"exclude": [
101+
"workspace/test-workspace/**"
102+
]
103+
}
102104
}

tap-snapshots/test/apply/files-snapshots.js.test.cjs

+9-9
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* Make sure to inspect the output below. Do not ignore changes!
66
*/
77
'use strict'
8-
exports[`test/apply/files-snapshots.js TAP private workspace > expect resolving Promise 1`] = `
8+
exports[`test/apply/files-snapshots.js > TAP > private workspace > promise must resolve to match snapshot 1`] = `
99
.commitlintrc.js
1010
.eslintrc.js
1111
.github/actions/create-check/action.yml
@@ -42,7 +42,7 @@ workspaces/b/.gitignore
4242
workspaces/b/package.json
4343
`
4444

45-
exports[`test/apply/files-snapshots.js TAP turn off add/rm types > expect resolving Promise 1`] = `
45+
exports[`test/apply/files-snapshots.js > TAP > turn off add/rm types > promise must resolve to match snapshot 1`] = `
4646
.commitlintrc.js
4747
.github/actions/create-check/action.yml
4848
.github/actions/install-latest-npm/action.yml
@@ -65,7 +65,7 @@ package.json
6565
release-please-config.json
6666
`
6767

68-
exports[`test/apply/files-snapshots.js TAP turn off module > expect resolving Promise 1`] = `
68+
exports[`test/apply/files-snapshots.js > TAP > turn off module > promise must resolve to match snapshot 1`] = `
6969
.commitlintrc.js
7070
.github/actions/create-check/action.yml
7171
.github/actions/install-latest-npm/action.yml
@@ -88,7 +88,7 @@ package.json
8888
release-please-config.json
8989
`
9090

91-
exports[`test/apply/files-snapshots.js TAP turn off repo > expect resolving Promise 1`] = `
91+
exports[`test/apply/files-snapshots.js > TAP > turn off repo > promise must resolve to match snapshot 1`] = `
9292
.eslintrc.js
9393
.gitignore
9494
.npmrc
@@ -98,11 +98,11 @@ package.json
9898
SECURITY.md
9999
`
100100

101-
exports[`test/apply/files-snapshots.js TAP turn off root > expect resolving Promise 1`] = `
101+
exports[`test/apply/files-snapshots.js > TAP > turn off root > promise must resolve to match snapshot 1`] = `
102102
package.json
103103
`
104104

105-
exports[`test/apply/files-snapshots.js TAP turn off specific files > expect resolving Promise 1`] = `
105+
exports[`test/apply/files-snapshots.js > TAP > turn off specific files > promise must resolve to match snapshot 1`] = `
106106
.eslintrc.yml
107107
.github/actions/create-check/action.yml
108108
.github/actions/install-latest-npm/action.yml
@@ -131,7 +131,7 @@ release-please-config.json
131131
SECURITY.md
132132
`
133133

134-
exports[`test/apply/files-snapshots.js TAP workspaces > expect resolving Promise 1`] = `
134+
exports[`test/apply/files-snapshots.js > TAP > workspaces > promise must resolve to match snapshot 1`] = `
135135
.github/actions/create-check/action.yml
136136
.github/actions/install-latest-npm/action.yml
137137
.github/dependabot.yml
@@ -158,7 +158,7 @@ workspaces/d/.gitignore
158158
workspaces/d/package.json
159159
`
160160

161-
exports[`test/apply/files-snapshots.js TAP workspaces only (like npm/cli) > expect resolving Promise 1`] = `
161+
exports[`test/apply/files-snapshots.js > TAP > workspaces only (like npm/cli) > promise must resolve to match snapshot 1`] = `
162162
.github/actions/create-check/action.yml
163163
.github/actions/install-latest-npm/action.yml
164164
.github/dependabot.yml
@@ -182,7 +182,7 @@ workspaces/b/.gitignore
182182
workspaces/b/package.json
183183
`
184184

185-
exports[`test/apply/files-snapshots.js TAP workspaces with relative content path > expect resolving Promise 1`] = `
185+
exports[`test/apply/files-snapshots.js > TAP > workspaces with relative content path > promise must resolve to match snapshot 1`] = `
186186
content_dir/index.js
187187
content_dir2/index.js
188188
package.json

tap-snapshots/test/apply/source-snapshots.js.test.cjs

+5-5
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* Make sure to inspect the output below. Do not ignore changes!
66
*/
77
'use strict'
8-
exports[`test/apply/source-snapshots.js TAP root only > expect resolving Promise 1`] = `
8+
exports[`test/apply/source-snapshots.js > TAP > root only > promise must resolve to match snapshot 1`] = `
99
.commitlintrc.js
1010
========================================
1111
/* This file is automatically added by @npmcli/template-oss. Do not edit. */
@@ -1426,7 +1426,7 @@ If the vulnerability you have found is [in scope for the GitHub Bug Bounty Progr
14261426
Thanks for helping make GitHub safe for everyone.
14271427
`
14281428

1429-
exports[`test/apply/source-snapshots.js TAP with content path > expect resolving Promise 1`] = `
1429+
exports[`test/apply/source-snapshots.js > TAP > with content path > promise must resolve to match snapshot 1`] = `
14301430
content_dir/index.js
14311431
========================================
14321432
module.exports={}
@@ -1444,7 +1444,7 @@ package.json
14441444
}
14451445
`
14461446

1447-
exports[`test/apply/source-snapshots.js TAP with workspaces > expect resolving Promise 1`] = `
1447+
exports[`test/apply/source-snapshots.js > TAP > with workspaces > promise must resolve to match snapshot 1`] = `
14481448
.commitlintrc.js
14491449
========================================
14501450
/* This file is automatically added by @npmcli/template-oss. Do not edit. */
@@ -3272,7 +3272,7 @@ workspaces/b/package.json
32723272
}
32733273
`
32743274

3275-
exports[`test/apply/source-snapshots.js TAP workspaces only > expect resolving Promise 1`] = `
3275+
exports[`test/apply/source-snapshots.js > TAP > workspaces only > promise must resolve to match snapshot 1`] = `
32763276
.github/actions/create-check/action.yml
32773277
========================================
32783278
# This file is automatically added by @npmcli/template-oss. Do not edit.
@@ -4636,7 +4636,7 @@ workspaces/b/package.json
46364636
}
46374637
`
46384638

4639-
exports[`test/apply/source-snapshots.js TAP workspaces with nested content path > expect resolving Promise 1`] = `
4639+
exports[`test/apply/source-snapshots.js > TAP > workspaces with nested content path > promise must resolve to match snapshot 1`] = `
46404640
content_dir/index.js
46414641
========================================
46424642
module.exports={}

tap-snapshots/test/bin/check.js.test.cjs

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* Make sure to inspect the output below. Do not ignore changes!
66
*/
77
'use strict'
8-
exports[`test/bin/check.js TAP problems > must match snapshot 1`] = `
8+
exports[`test/bin/check.js > TAP > problems > must match snapshot 1`] = `
99
1010
Some problems were detected:
1111

tap-snapshots/test/check/diff-snapshots.js.test.cjs

+8-8
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* Make sure to inspect the output below. Do not ignore changes!
66
*/
77
'use strict'
8-
exports[`test/check/diff-snapshots.js TAP different headers > expect resolving Promise 1`] = `
8+
exports[`test/check/diff-snapshots.js > TAP > different headers > promise must resolve to match snapshot 1`] = `
99
Some problems were detected:
1010
1111
-------------------------------------------------------------------
@@ -21,7 +21,7 @@ To correct it: npx template-oss-apply --force
2121
-------------------------------------------------------------------
2222
`
2323

24-
exports[`test/check/diff-snapshots.js TAP json delete > expect resolving Promise 1`] = `
24+
exports[`test/check/diff-snapshots.js > TAP > json delete > promise must resolve to match snapshot 1`] = `
2525
Some problems were detected:
2626
2727
-------------------------------------------------------------------
@@ -39,7 +39,7 @@ To correct it: npx template-oss-apply --force
3939
-------------------------------------------------------------------
4040
`
4141

42-
exports[`test/check/diff-snapshots.js TAP json merge > initial check 1`] = `
42+
exports[`test/check/diff-snapshots.js > TAP > json merge > initial check 1`] = `
4343
Some problems were detected:
4444
4545
-------------------------------------------------------------------
@@ -56,7 +56,7 @@ To correct it: npx template-oss-apply --force
5656
-------------------------------------------------------------------
5757
`
5858

59-
exports[`test/check/diff-snapshots.js TAP json overwrite > expect resolving Promise 1`] = `
59+
exports[`test/check/diff-snapshots.js > TAP > json overwrite > promise must resolve to match snapshot 1`] = `
6060
Some problems were detected:
6161
6262
-------------------------------------------------------------------
@@ -73,7 +73,7 @@ To correct it: npx template-oss-apply --force
7373
-------------------------------------------------------------------
7474
`
7575

76-
exports[`test/check/diff-snapshots.js TAP unknown file type > expect resolving Promise 1`] = `
76+
exports[`test/check/diff-snapshots.js > TAP > unknown file type > promise must resolve to match snapshot 1`] = `
7777
Some problems were detected:
7878
7979
-------------------------------------------------------------------
@@ -87,7 +87,7 @@ To correct it: npx template-oss-apply --force
8787
-------------------------------------------------------------------
8888
`
8989

90-
exports[`test/check/diff-snapshots.js TAP update and remove errors > expect resolving Promise 1`] = `
90+
exports[`test/check/diff-snapshots.js > TAP > update and remove errors > promise must resolve to match snapshot 1`] = `
9191
Some problems were detected:
9292
9393
-------------------------------------------------------------------
@@ -97,7 +97,7 @@ The repo file audit.yml needs to be updated:
9797
.github/workflows/audit.yml
9898
========================================
9999
[@npmcli/template-oss ERROR] There was an erroring getting the target file
100-
[@npmcli/template-oss ERROR] Error: {{ROOT}}/test/check/tap-testdir-diff-snapshots-update-and-remove-errors/.github/workflows/audit.yml
100+
[@npmcli/template-oss ERROR] Error: {{ROOT}}/.tap/fixtures/test-check-diff-snapshots.js-update-and-remove-errors/.github/workflows/audit.yml
101101
102102
YAMLParseError: Implicit keys need to be on a single line at line 42, column 1:
103103
@@ -222,7 +222,7 @@ To correct it: npx template-oss-apply --force
222222
-------------------------------------------------------------------
223223
`
224224

225-
exports[`test/check/diff-snapshots.js TAP will diff json > expect resolving Promise 1`] = `
225+
exports[`test/check/diff-snapshots.js > TAP > will diff json > promise must resolve to match snapshot 1`] = `
226226
Some problems were detected:
227227
228228
-------------------------------------------------------------------

0 commit comments

Comments
 (0)