Skip to content

Commit e88c758

Browse files
owlstronautwraithgar
authored andcommitted
chore: swap from tap to built-in node:test
1 parent 0cd1a4d commit e88c758

17 files changed

Lines changed: 394 additions & 374 deletions

.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:

package.json

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,16 @@
2121
"homepage": "https://github.com/npm/hosted-git-info",
2222
"scripts": {
2323
"posttest": "npm run lint",
24-
"snap": "tap",
25-
"test": "tap",
24+
"snap": "node --test --test-update-snapshots './test/**/*.js'",
25+
"test": "node --test './test/**/*.js'",
2626
"test:coverage": "tap --coverage-report=html",
2727
"lint": "npm run eslint",
2828
"postlint": "template-oss-check",
2929
"lintfix": "npm run eslint -- --fix",
3030
"template-oss-apply": "template-oss-apply --force",
31-
"eslint": "eslint \"**/*.{js,cjs,ts,mjs,jsx,tsx}\""
31+
"eslint": "eslint \"**/*.{js,cjs,ts,mjs,jsx,tsx}\"",
32+
"test:node20": "node --test test",
33+
"test:cover": "node --test --experimental-test-coverage --test-timeout=3000 --test-coverage-lines=100 --test-coverage-functions=100 --test-coverage-branches=100 './test/**/*.js'"
3234
},
3335
"dependencies": {
3436
"lru-cache": "^11.1.0"
@@ -45,17 +47,11 @@
4547
"engines": {
4648
"node": "^20.17.0 || >=22.9.0"
4749
},
48-
"tap": {
49-
"color": 1,
50-
"coverage": true,
51-
"nyc-arg": [
52-
"--exclude",
53-
"tap-snapshots/**"
54-
]
55-
},
5650
"templateOSS": {
5751
"//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.",
5852
"version": "4.28.1",
59-
"publish": "true"
53+
"publish": "true",
54+
"testRunner": "node:test",
55+
"latestCiVersion": 24
6056
}
6157
}

test/bitbucket.js

Lines changed: 57 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,15 @@
11
/* eslint-disable max-len */
22
'use strict'
3+
const { test } = require('node:test')
4+
const assert = require('node:assert')
35
const HostedGit = require('..')
4-
const t = require('tap')
6+
7+
// Helper function to assert actual object contains all expected properties
8+
const assertHasStrict = (actual, expected, message) => {
9+
for (const [key, value] of Object.entries(expected)) {
10+
assert.strictEqual(actual[key], value, `${message} (${key})`)
11+
}
12+
}
513

614
const invalid = [
715
// invalid protocol
@@ -142,75 +150,70 @@ const valid = {
142150
'https://:[email protected]/foo/bar.git#branch': { ...defaults, default: 'https', auth: ':password', committish: 'branch' },
143151
}
144152

145-
t.test('valid urls parse properly', t => {
146-
t.plan(Object.keys(valid).length)
153+
test('valid urls parse properly', () => {
147154
for (const [url, result] of Object.entries(valid)) {
148-
t.hasStrict(HostedGit.fromUrl(url), result, `${url} parses`)
155+
const parsed = HostedGit.fromUrl(url)
156+
assertHasStrict(parsed, result, `${url} parses`)
149157
}
150158
})
151159

152-
t.test('invalid urls return undefined', t => {
153-
t.plan(invalid.length)
160+
test('invalid urls return undefined', () => {
154161
for (const url of invalid) {
155-
t.equal(HostedGit.fromUrl(url), undefined, `${url} returns undefined`)
162+
assert.strictEqual(HostedGit.fromUrl(url), undefined, `${url} returns undefined`)
156163
}
157164
})
158165

159-
t.test('toString respects defaults', t => {
166+
test('toString respects defaults', () => {
160167
const sshurl = HostedGit.fromUrl('git+ssh://bitbucket.org/foo/bar')
161-
t.equal(sshurl.default, 'sshurl', 'got the right default')
162-
t.equal(sshurl.toString(), sshurl.sshurl(), 'toString calls sshurl')
168+
assert.strictEqual(sshurl.default, 'sshurl', 'got the right default')
169+
assert.strictEqual(sshurl.toString(), sshurl.sshurl(), 'toString calls sshurl')
163170

164171
const https = HostedGit.fromUrl('https://bitbucket.org/foo/bar')
165-
t.equal(https.default, 'https', 'got the right default')
166-
t.equal(https.toString(), https.https(), 'toString calls https')
172+
assert.strictEqual(https.default, 'https', 'got the right default')
173+
assert.strictEqual(https.toString(), https.https(), 'toString calls https')
167174

168175
const shortcut = HostedGit.fromUrl('bitbucket:foo/bar')
169-
t.equal(shortcut.default, 'shortcut', 'got the right default')
170-
t.equal(shortcut.toString(), shortcut.shortcut(), 'toString calls shortcut')
171-
172-
t.end()
176+
assert.strictEqual(shortcut.default, 'shortcut', 'got the right default')
177+
assert.strictEqual(shortcut.toString(), shortcut.shortcut(), 'toString calls shortcut')
173178
})
174179

175-
t.test('string methods populate correctly', t => {
180+
test('string methods populate correctly', () => {
176181
const parsed = HostedGit.fromUrl('git+ssh://bitbucket.org/foo/bar')
177-
t.equal(parsed.getDefaultRepresentation(), parsed.default, 'getDefaultRepresentation()')
178-
t.equal(parsed.hash(), '', 'hash() returns empty string when committish is unset')
179-
t.equal(parsed.ssh(), '[email protected]:foo/bar.git')
180-
t.equal(parsed.sshurl(), 'git+ssh://[email protected]/foo/bar.git')
181-
t.equal(parsed.edit(), 'https://bitbucket.org/foo/bar')
182-
t.equal(parsed.edit('/lib/index.js'), 'https://bitbucket.org/foo/bar/src/HEAD/lib/index.js?mode=edit')
183-
t.equal(parsed.browse(), 'https://bitbucket.org/foo/bar')
184-
t.equal(parsed.browse('/lib/index.js'), 'https://bitbucket.org/foo/bar/src/HEAD/lib/index.js')
185-
t.equal(parsed.browse('/lib/index.js', 'L100'), 'https://bitbucket.org/foo/bar/src/HEAD/lib/index.js#l100')
186-
t.equal(parsed.docs(), 'https://bitbucket.org/foo/bar#readme')
187-
t.equal(parsed.https(), 'git+https://bitbucket.org/foo/bar.git')
188-
t.equal(parsed.shortcut(), 'bitbucket:foo/bar')
189-
t.equal(parsed.path(), 'foo/bar')
190-
t.equal(parsed.tarball(), 'https://bitbucket.org/foo/bar/get/HEAD.tar.gz')
191-
t.equal(parsed.file(), 'https://bitbucket.org/foo/bar/raw/HEAD/')
192-
t.equal(parsed.file('/lib/index.js'), 'https://bitbucket.org/foo/bar/raw/HEAD/lib/index.js')
193-
t.equal(parsed.bugs(), 'https://bitbucket.org/foo/bar/issues')
194-
195-
t.equal(parsed.docs({ committish: 'fix/bug' }), 'https://bitbucket.org/foo/bar/src/fix%2Fbug#readme', 'allows overriding options')
196-
197-
t.same(parsed.git(), null, 'git() returns null')
182+
assert.strictEqual(parsed.getDefaultRepresentation(), parsed.default, 'getDefaultRepresentation()')
183+
assert.strictEqual(parsed.hash(), '', 'hash() returns empty string when committish is unset')
184+
assert.strictEqual(parsed.ssh(), '[email protected]:foo/bar.git')
185+
assert.strictEqual(parsed.sshurl(), 'git+ssh://[email protected]/foo/bar.git')
186+
assert.strictEqual(parsed.edit(), 'https://bitbucket.org/foo/bar')
187+
assert.strictEqual(parsed.edit('/lib/index.js'), 'https://bitbucket.org/foo/bar/src/HEAD/lib/index.js?mode=edit')
188+
assert.strictEqual(parsed.browse(), 'https://bitbucket.org/foo/bar')
189+
assert.strictEqual(parsed.browse('/lib/index.js'), 'https://bitbucket.org/foo/bar/src/HEAD/lib/index.js')
190+
assert.strictEqual(parsed.browse('/lib/index.js', 'L100'), 'https://bitbucket.org/foo/bar/src/HEAD/lib/index.js#l100')
191+
assert.strictEqual(parsed.docs(), 'https://bitbucket.org/foo/bar#readme')
192+
assert.strictEqual(parsed.https(), 'git+https://bitbucket.org/foo/bar.git')
193+
assert.strictEqual(parsed.shortcut(), 'bitbucket:foo/bar')
194+
assert.strictEqual(parsed.path(), 'foo/bar')
195+
assert.strictEqual(parsed.tarball(), 'https://bitbucket.org/foo/bar/get/HEAD.tar.gz')
196+
assert.strictEqual(parsed.file(), 'https://bitbucket.org/foo/bar/raw/HEAD/')
197+
assert.strictEqual(parsed.file('/lib/index.js'), 'https://bitbucket.org/foo/bar/raw/HEAD/lib/index.js')
198+
assert.strictEqual(parsed.bugs(), 'https://bitbucket.org/foo/bar/issues')
199+
200+
assert.strictEqual(parsed.docs({ committish: 'fix/bug' }), 'https://bitbucket.org/foo/bar/src/fix%2Fbug#readme', 'allows overriding options')
201+
202+
assert.deepStrictEqual(parsed.git(), null, 'git() returns null')
198203

199204
const extra = HostedGit.fromUrl('https://[email protected]/foo/bar#fix/bug')
200-
t.equal(extra.hash(), '#fix/bug')
201-
t.equal(extra.https(), 'git+https://[email protected]/foo/bar.git#fix/bug')
202-
t.equal(extra.shortcut(), 'bitbucket:foo/bar#fix/bug')
203-
t.equal(extra.ssh(), '[email protected]:foo/bar.git#fix/bug')
204-
t.equal(extra.sshurl(), 'git+ssh://[email protected]/foo/bar.git#fix/bug')
205-
t.equal(extra.browse(), 'https://bitbucket.org/foo/bar/src/fix%2Fbug')
206-
t.equal(extra.browse('/lib/index.js'), 'https://bitbucket.org/foo/bar/src/fix%2Fbug/lib/index.js')
207-
t.equal(extra.browse('/lib/index.js', 'L200'), 'https://bitbucket.org/foo/bar/src/fix%2Fbug/lib/index.js#l200')
208-
t.equal(extra.docs(), 'https://bitbucket.org/foo/bar/src/fix%2Fbug#readme')
209-
t.equal(extra.file(), 'https://bitbucket.org/foo/bar/raw/fix%2Fbug/')
210-
t.equal(extra.file('/lib/index.js'), 'https://bitbucket.org/foo/bar/raw/fix%2Fbug/lib/index.js')
211-
212-
t.equal(extra.sshurl({ noCommittish: true }), 'git+ssh://[email protected]/foo/bar.git', 'noCommittish drops committish from urls')
213-
t.equal(extra.sshurl({ noGitPlus: true }), 'ssh://[email protected]/foo/bar.git#fix/bug', 'noGitPlus drops git+ prefix from urls')
214-
215-
t.end()
205+
assert.strictEqual(extra.hash(), '#fix/bug')
206+
assert.strictEqual(extra.https(), 'git+https://[email protected]/foo/bar.git#fix/bug')
207+
assert.strictEqual(extra.shortcut(), 'bitbucket:foo/bar#fix/bug')
208+
assert.strictEqual(extra.ssh(), '[email protected]:foo/bar.git#fix/bug')
209+
assert.strictEqual(extra.sshurl(), 'git+ssh://[email protected]/foo/bar.git#fix/bug')
210+
assert.strictEqual(extra.browse(), 'https://bitbucket.org/foo/bar/src/fix%2Fbug')
211+
assert.strictEqual(extra.browse('/lib/index.js'), 'https://bitbucket.org/foo/bar/src/fix%2Fbug/lib/index.js')
212+
assert.strictEqual(extra.browse('/lib/index.js', 'L200'), 'https://bitbucket.org/foo/bar/src/fix%2Fbug/lib/index.js#l200')
213+
assert.strictEqual(extra.docs(), 'https://bitbucket.org/foo/bar/src/fix%2Fbug#readme')
214+
assert.strictEqual(extra.file(), 'https://bitbucket.org/foo/bar/raw/fix%2Fbug/')
215+
assert.strictEqual(extra.file('/lib/index.js'), 'https://bitbucket.org/foo/bar/raw/fix%2Fbug/lib/index.js')
216+
217+
assert.strictEqual(extra.sshurl({ noCommittish: true }), 'git+ssh://[email protected]/foo/bar.git', 'noCommittish drops committish from urls')
218+
assert.strictEqual(extra.sshurl({ noGitPlus: true }), 'ssh://[email protected]/foo/bar.git#fix/bug', 'noGitPlus drops git+ prefix from urls')
216219
})

test/file.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
1+
const { test } = require('node:test')
2+
const assert = require('node:assert')
13
const HostedGit = require('..')
2-
const t = require('tap')
34

4-
t.test('file:// URLs', t => {
5+
test('file:// URLs', () => {
56
const fileRepo = {
67
name: 'foo',
78
repository: {
89
url: 'file:///path/dot.git',
910
},
1011
}
11-
t.equal(HostedGit.fromManifest(fileRepo), null)
12-
13-
t.end()
12+
assert.strictEqual(HostedGit.fromManifest(fileRepo), null)
1413
})

0 commit comments

Comments
 (0)