Skip to content

Commit a342af8

Browse files
committed
feat: swap from tap to built-in node:test
1 parent d930d2f commit a342af8

File tree

10 files changed

+144
-115
lines changed

10 files changed

+144
-115
lines changed

.github/workflows/audit.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ jobs:
3030
uses: actions/setup-node@v4
3131
id: node
3232
with:
33-
node-version: 22.x
34-
check-latest: contains('22.x', '.x')
33+
node-version: 24.x
34+
check-latest: contains('24.x', '.x')
3535
- name: Install Latest npm
3636
uses: ./.github/actions/install-latest-npm
3737
with:

.github/workflows/ci-release.yml

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@ jobs:
5151
uses: actions/setup-node@v4
5252
id: node
5353
with:
54-
node-version: 22.x
55-
check-latest: contains('22.x', '.x')
54+
node-version: 24.x
55+
check-latest: contains('24.x', '.x')
5656
- name: Install Latest npm
5757
uses: ./.github/actions/install-latest-npm
5858
with:
@@ -95,6 +95,7 @@ jobs:
9595
- 20.x
9696
- 22.9.0
9797
- 22.x
98+
- 24.x
9899
exclude:
99100
- platform: { name: macOS, os: macos-13, shell: bash }
100101
node-version: 20.17.0
@@ -104,6 +105,8 @@ jobs:
104105
node-version: 22.9.0
105106
- platform: { name: macOS, os: macos-13, shell: bash }
106107
node-version: 22.x
108+
- platform: { name: macOS, os: macos-13, shell: bash }
109+
node-version: 24.x
107110
runs-on: ${{ matrix.platform.os }}
108111
defaults:
109112
run:
@@ -137,9 +140,14 @@ jobs:
137140
node: ${{ steps.node.outputs.node-version }}
138141
- name: Install Dependencies
139142
run: npm i --ignore-scripts --no-audit --no-fund
140-
- name: Add Problem Matcher
141-
run: echo "::add-matcher::.github/matchers/tap.json"
143+
- name: Test (with coverage on Node >= 24)
144+
if: ${{ startsWith(matrix.node-version, '24') }}
145+
run: npm run test:cover --ignore-scripts
146+
- name: Test (on Node 20 with globbing workaround)
147+
if: ${{ startsWith(matrix.node-version, '20') }}
148+
run: npm run test:node20 --ignore-scripts
142149
- name: Test
150+
if: ${{ !startsWith(matrix.node-version, '24') && !startsWith(matrix.node-version, '20') }}
143151
run: npm test --ignore-scripts
144152
- name: Conclude Check
145153
uses: LouisBrunner/[email protected]

.github/workflows/ci.yml

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ jobs:
3434
uses: actions/setup-node@v4
3535
id: node
3636
with:
37-
node-version: 22.x
38-
check-latest: contains('22.x', '.x')
37+
node-version: 24.x
38+
check-latest: contains('24.x', '.x')
3939
- name: Install Latest npm
4040
uses: ./.github/actions/install-latest-npm
4141
with:
@@ -71,6 +71,7 @@ jobs:
7171
- 20.x
7272
- 22.9.0
7373
- 22.x
74+
- 24.x
7475
exclude:
7576
- platform: { name: macOS, os: macos-13, shell: bash }
7677
node-version: 20.17.0
@@ -80,6 +81,8 @@ jobs:
8081
node-version: 22.9.0
8182
- platform: { name: macOS, os: macos-13, shell: bash }
8283
node-version: 22.x
84+
- platform: { name: macOS, os: macos-13, shell: bash }
85+
node-version: 24.x
8386
runs-on: ${{ matrix.platform.os }}
8487
defaults:
8588
run:
@@ -103,7 +106,12 @@ jobs:
103106
node: ${{ steps.node.outputs.node-version }}
104107
- name: Install Dependencies
105108
run: npm i --ignore-scripts --no-audit --no-fund
106-
- name: Add Problem Matcher
107-
run: echo "::add-matcher::.github/matchers/tap.json"
109+
- name: Test (with coverage on Node >= 24)
110+
if: ${{ startsWith(matrix.node-version, '24') }}
111+
run: npm run test:cover --ignore-scripts
112+
- name: Test (on Node 20 with globbing workaround)
113+
if: ${{ startsWith(matrix.node-version, '20') }}
114+
run: npm run test:node20 --ignore-scripts
108115
- name: Test
116+
if: ${{ !startsWith(matrix.node-version, '24') && !startsWith(matrix.node-version, '20') }}
109117
run: npm test --ignore-scripts

.github/workflows/post-dependabot.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ jobs:
2828
uses: actions/setup-node@v4
2929
id: node
3030
with:
31-
node-version: 22.x
32-
check-latest: contains('22.x', '.x')
31+
node-version: 24.x
32+
check-latest: contains('24.x', '.x')
3333
- name: Install Latest npm
3434
uses: ./.github/actions/install-latest-npm
3535
with:

.github/workflows/pull-request.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ jobs:
3434
uses: actions/setup-node@v4
3535
id: node
3636
with:
37-
node-version: 22.x
38-
check-latest: contains('22.x', '.x')
37+
node-version: 24.x
38+
check-latest: contains('24.x', '.x')
3939
- name: Install Latest npm
4040
uses: ./.github/actions/install-latest-npm
4141
with:

.github/workflows/release-integration.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@ jobs:
4545
uses: actions/setup-node@v4
4646
id: node
4747
with:
48-
node-version: 22.x
49-
check-latest: contains('22.x', '.x')
48+
node-version: 24.x
49+
check-latest: contains('24.x', '.x')
5050
- name: Install Latest npm
5151
uses: ./.github/actions/install-latest-npm
5252
with:

.github/workflows/release.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ jobs:
3939
uses: actions/setup-node@v4
4040
id: node
4141
with:
42-
node-version: 22.x
43-
check-latest: contains('22.x', '.x')
42+
node-version: 24.x
43+
check-latest: contains('24.x', '.x')
4444
- name: Install Latest npm
4545
uses: ./.github/actions/install-latest-npm
4646
with:
@@ -119,8 +119,8 @@ jobs:
119119
uses: actions/setup-node@v4
120120
id: node
121121
with:
122-
node-version: 22.x
123-
check-latest: contains('22.x', '.x')
122+
node-version: 24.x
123+
check-latest: contains('24.x', '.x')
124124
- name: Install Latest npm
125125
uses: ./.github/actions/install-latest-npm
126126
with:

lib/index.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,13 @@ const parseError = (e, txt, context = 20) => {
5252
let errIdx
5353
if (badIndexMatch) {
5454
errIdx = +badIndexMatch[1]
55-
} else /* istanbul ignore next - doesnt happen in Node 22 */ if (
55+
} else /* node:coverage disable */ if (
56+
// doesn't happen in Node 22+
5657
msg.match(/^Unexpected end of JSON.*/i)
5758
) {
5859
errIdx = txt.length - 1
5960
}
61+
/* node:coverage enable */
6062

6163
if (errIdx == null) {
6264
return makeParsedError(msg, `'${txt.slice(0, context * 2)}'`)

package.json

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,20 @@
88
"lib/"
99
],
1010
"scripts": {
11-
"test": "tap",
12-
"snap": "tap",
11+
"test": "node --test './test/**/*.js'",
12+
"snap": "node --test --test-update-snapshots './test/**/*.js'",
1313
"lint": "npm run eslint",
1414
"postlint": "template-oss-check",
1515
"template-oss-apply": "template-oss-apply --force",
1616
"lintfix": "npm run eslint -- --fix",
1717
"posttest": "npm run lint",
18-
"eslint": "eslint \"**/*.{js,cjs,ts,mjs,jsx,tsx}\""
18+
"eslint": "eslint \"**/*.{js,cjs,ts,mjs,jsx,tsx}\"",
19+
"test:node20": "node --test test",
20+
"test:cover": "node --test --experimental-test-coverage --test-timeout=3000 --test-coverage-lines=100 --test-coverage-functions=100 --test-coverage-branches=100 './test/**/*.js'"
1921
},
2022
"repository": {
2123
"type": "git",
22-
"url": "git+https://github.com/npm/json-parse-even-better-errors.git"
24+
"url": "git+https://github.com/npm/json-parse-better-errors.git"
2325
},
2426
"keywords": [
2527
"JSON",
@@ -32,19 +34,14 @@
3234
"@npmcli/template-oss": "4.28.1",
3335
"tap": "^16.3.0"
3436
},
35-
"tap": {
36-
"check-coverage": true,
37-
"nyc-arg": [
38-
"--exclude",
39-
"tap-snapshots/**"
40-
]
41-
},
4237
"engines": {
4338
"node": "^20.17.0 || >=22.9.0"
4439
},
4540
"templateOSS": {
4641
"//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.",
4742
"version": "4.28.1",
48-
"publish": true
43+
"publish": true,
44+
"testRunner": "node:test",
45+
"latestCiVersion": 24
4946
}
5047
}

0 commit comments

Comments
 (0)