Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 25a3e0b

Browse files
committedMar 7, 2025·
chore: move from tap to Node.js test runner
This eliminates a (bogus) security warning about a tap dependency.
1 parent f10ad1a commit 25a3e0b

9 files changed

+271
-4321
lines changed
 

‎package-lock.json

+146-4,185
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎package.json

+2-3
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"type": "module",
66
"scripts": {
77
"start": "node server.js | bunyan -o short",
8-
"test": "STATUS=0; tap --allow-incomplete-coverage test/**/*.test.js || STATUS=$?; standard || STATUS=$?; exit $STATUS",
8+
"test": "STATUS=0; node --test test/**/*.test.js || STATUS=$?; standard || STATUS=$?; exit $STATUS",
99
"test:watch": "nodemon -q -x 'npm test'"
1010
},
1111
"engines": {
@@ -33,7 +33,6 @@
3333
"nock": "^14.0.1",
3434
"nodemon": "^3.1.9",
3535
"standard": "^17.1.2",
36-
"supertest": "^7.0.0",
37-
"tap": "^21.1.0"
36+
"supertest": "^7.0.0"
3837
}
3938
}
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import tap from 'tap'
1+
import test from 'node:test'
22
import fetchMock from 'fetch-mock'
33
import supertest from 'supertest'
44

@@ -10,20 +10,20 @@ import eventRelay from '../../scripts/event-relay.js'
1010

1111
eventRelay(app, events)
1212

13-
tap.test('Sends POST requests to https://api.github.com/repos/nodejs/<repo>/dispatches', (t) => {
13+
test('Sends POST requests to https://api.github.com/repos/nodejs/<repo>/dispatches', (t) => {
1414
const jenkinsPayload = readFixture('success-payload.json')
1515

1616
fetchMock.mockGlobal()
1717
fetchMock.route('https://api.github.com/repos/nodejs/node/dispatches', 204)
1818

19-
t.plan(2)
19+
t.plan(2, { wait: 2000 })
2020

2121
supertest(app)
2222
.post('/node/jenkins/start')
2323
.send(jenkinsPayload)
2424
.expect(200)
2525
.end((err, res) => {
26-
t.equal(err, null)
27-
t.equal(fetchMock.callHistory.called(), true)
26+
t.assert.strictEqual(err, null)
27+
t.assert.strictEqual(fetchMock.callHistory.called(), true)
2828
})
2929
})

‎test/integration/ping.test.js

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,30 @@
11
import http from 'node:http'
22

3-
import tap from 'tap'
3+
import test from 'node:test'
44

55
import { app, events } from '../../app.js'
66

77
import ping from '../../scripts/ping.js'
88

99
ping(app, events)
1010

11-
tap.test('GET /ping responds with status 200 / "pong"', (t) => {
11+
test('GET /ping responds with status 200 / "pong"', (t) => {
1212
const server = app.listen()
1313
const port = server.address().port
1414
const url = `http://localhost:${port}/ping`
1515

16-
t.plan(2)
17-
t.teardown(() => server.close())
16+
t.plan(2, { wait: 2000 })
17+
t.after(() => server.close())
1818

1919
http.get(url, (res) => {
20-
t.equal(res.statusCode, 200)
20+
t.assert.strictEqual(res.statusCode, 200)
2121

2222
let data = ''
2323
res.on('data', (chunk) => {
2424
data += chunk
2525
})
2626
res.on('end', () => {
27-
t.equal(data, 'pong')
27+
t.assert.strictEqual(data, 'pong')
2828
})
2929
}).on('error', (e) => {
3030
t.fail(e)

‎test/integration/push-jenkins-update.test.js

+41-41
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import tap from 'tap'
1+
import test from 'node:test'
22
import fetchMock from 'fetch-mock'
33
import supertest from 'supertest'
44

@@ -13,70 +13,70 @@ fetchMock.mockGlobal()
1313

1414
jenkinsStatus(app, events)
1515

16-
tap.test('Sends POST requests to https://api.github.com/repos/nodejs/node/statuses/<SHA>', (t) => {
16+
test('Sends POST requests to https://api.github.com/repos/nodejs/node/statuses/<SHA>', (t) => {
1717
const jenkinsPayload = readFixture('success-payload.json')
1818

1919
const listCommitsUrl = setupListCommitsMock('node')
2020

2121
const url = 'https://api.github.com/repos/nodejs/node/statuses/8a5fec2a6bade91e544a30314d7cf21f8a200de1'
2222
fetchMock.route({ url, method: 'POST' }, 201)
2323

24-
t.plan(3)
24+
t.plan(3, { wait: 2000 })
2525

2626
supertest(app)
2727
.post('/node/jenkins/start')
2828
.send(jenkinsPayload)
2929
.expect(200)
3030
.end((err, res) => {
31-
t.equal(err, null)
32-
t.equal(fetchMock.callHistory.called(url), true)
33-
t.equal(fetchMock.callHistory.called(listCommitsUrl), true)
31+
t.assert.strictEqual(err, null)
32+
t.assert.strictEqual(fetchMock.callHistory.called(url), true)
33+
t.assert.strictEqual(fetchMock.callHistory.called(listCommitsUrl), true)
3434
})
3535
})
3636

37-
tap.test('Allows repository name to be provided with URL parameter when pushing job started', (t) => {
37+
test('Allows repository name to be provided with URL parameter when pushing job started', (t) => {
3838
const jenkinsPayload = readFixture('pending-payload.json')
3939

4040
const listCommitsUrl = setupListCommitsMock('citgm')
4141

4242
const url = 'https://api.github.com/repos/nodejs/citgm/statuses/8a5fec2a6bade91e544a30314d7cf21f8a200de1'
4343
fetchMock.route({ url, method: 'POST' }, 201)
4444

45-
t.plan(3)
45+
t.plan(3, { wait: 2000 })
4646

4747
supertest(app)
4848
.post('/citgm/jenkins/start')
4949
.send(jenkinsPayload)
5050
.expect(200)
5151
.end((err, res) => {
52-
t.equal(err, null)
53-
t.equal(fetchMock.callHistory.called(url), true)
54-
t.equal(fetchMock.callHistory.called(listCommitsUrl), true)
52+
t.assert.strictEqual(err, null)
53+
t.assert.strictEqual(fetchMock.callHistory.called(url), true)
54+
t.assert.strictEqual(fetchMock.callHistory.called(listCommitsUrl), true)
5555
})
5656
})
5757

58-
tap.test('Allows repository name to be provided with URL parameter when pushing job ended', (t) => {
58+
test('Allows repository name to be provided with URL parameter when pushing job ended', (t) => {
5959
const jenkinsPayload = readFixture('success-payload.json')
6060

6161
const listCommitsUrl = setupListCommitsMock('citgm')
6262

6363
const url = 'https://api.github.com/repos/nodejs/citgm/statuses/8a5fec2a6bade91e544a30314d7cf21f8a200de1'
6464
fetchMock.route({ url, method: 'POST' }, 201)
6565

66-
t.plan(3)
66+
t.plan(3, { wait: 2000 })
6767

6868
supertest(app)
6969
.post('/citgm/jenkins/end')
7070
.send(jenkinsPayload)
7171
.expect(200)
7272
.end((err, res) => {
73-
t.equal(err, null)
74-
t.equal(fetchMock.callHistory.called(url), true)
75-
t.equal(fetchMock.callHistory.called(listCommitsUrl), true)
73+
t.assert.strictEqual(err, null)
74+
t.assert.strictEqual(fetchMock.callHistory.called(url), true)
75+
t.assert.strictEqual(fetchMock.callHistory.called(listCommitsUrl), true)
7676
})
7777
})
7878

79-
tap.test('Forwards payload provided in incoming POST to GitHub status API', (t) => {
79+
test('Forwards payload provided in incoming POST to GitHub status API', (t) => {
8080
const fixture = readFixture('success-payload.json')
8181

8282
const listCommitsUrl = setupListCommitsMock('node')
@@ -90,20 +90,20 @@ tap.test('Forwards payload provided in incoming POST to GitHub status API', (t)
9090
}
9191
fetchMock.route({ url, method: 'POST', body }, 201)
9292

93-
t.plan(3)
93+
t.plan(3, { wait: 2000 })
9494

9595
supertest(app)
9696
.post('/node/jenkins/start')
9797
.send(fixture)
9898
.expect(200)
9999
.end((err, res) => {
100-
t.equal(err, null)
101-
t.equal(fetchMock.callHistory.called(url), true)
102-
t.equal(fetchMock.callHistory.called(listCommitsUrl), true)
100+
t.assert.strictEqual(err, null)
101+
t.assert.strictEqual(fetchMock.callHistory.called(url), true)
102+
t.assert.strictEqual(fetchMock.callHistory.called(listCommitsUrl), true)
103103
})
104104
})
105105

106-
tap.test('Posts a CI comment in the related PR when Jenkins build is named node-test-pull-request', (t) => {
106+
test('Posts a CI comment in the related PR when Jenkins build is named node-test-pull-request', (t) => {
107107
const fixture = readFixture('jenkins-test-pull-request-success-payload.json')
108108

109109
const url = 'https://api.github.com/repos/nodejs/node/issues/12345/comments'
@@ -118,19 +118,19 @@ tap.test('Posts a CI comment in the related PR when Jenkins build is named node-
118118
method: 'POST'
119119
}, 201)
120120

121-
t.plan(2)
121+
t.plan(2, { wait: 2000 })
122122

123123
supertest(app)
124124
.post('/node/jenkins/start')
125125
.send(fixture)
126126
.expect(200)
127127
.end((err, res) => {
128-
t.equal(fetchMock.callHistory.called(url), true)
129-
t.equal(err, null)
128+
t.assert.strictEqual(fetchMock.callHistory.called(url), true)
129+
t.assert.strictEqual(err, null)
130130
})
131131
})
132132

133-
tap.test('Posts a CI comment in the related PR when Jenkins build is named node-test-pull-request-lite-pipeline', (t) => {
133+
test('Posts a CI comment in the related PR when Jenkins build is named node-test-pull-request-lite-pipeline', (t) => {
134134
const fixture = readFixture('jenkins-test-pull-request-success-payload.json')
135135
fixture.identifier = 'node-test-pull-request-lite-pipeline'
136136

@@ -146,83 +146,83 @@ tap.test('Posts a CI comment in the related PR when Jenkins build is named node-
146146
method: 'POST'
147147
}, 201)
148148

149-
t.plan(2)
149+
t.plan(2, { wait: 2000 })
150150

151151
supertest(app)
152152
.post('/node/jenkins/start')
153153
.send(fixture)
154154
.expect(200)
155155
.end((err, res) => {
156-
t.equal(fetchMock.callHistory.called(url), true)
157-
t.equal(err, null)
156+
t.assert.strictEqual(fetchMock.callHistory.called(url), true)
157+
t.assert.strictEqual(err, null)
158158
})
159159
})
160160

161-
tap.test('Responds with 400 / "Bad request" when incoming request has invalid payload', (t) => {
161+
test('Responds with 400 / "Bad request" when incoming request has invalid payload', (t) => {
162162
const fixture = readFixture('invalid-payload.json')
163163

164164
// don't care about the results, just want to prevent any HTTP request ever being made
165165
fetchMock.route('https://api.github.com', 200)
166166

167-
t.plan(1)
167+
t.plan(1, { wait: 2000 })
168168

169169
supertest(app)
170170
.post('/node/jenkins/start')
171171
.send(fixture)
172172
.expect(400, 'Invalid payload')
173173
.end((err, res) => {
174-
t.equal(err, null)
174+
t.assert.strictEqual(err, null)
175175
})
176176
})
177177

178-
tap.test('Responds with 400 / "Bad request" when build started status update is not related to a pull request', (t) => {
178+
test('Responds with 400 / "Bad request" when build started status update is not related to a pull request', (t) => {
179179
const fixture = readFixture('jenkins-staging-failure-payload.json')
180180

181181
// don't care about the results, just want to prevent any HTTP request ever being made
182182
fetchMock.route('https://api.github.com', 200)
183183

184-
t.plan(1)
184+
t.plan(1, { wait: 2000 })
185185

186186
supertest(app)
187187
.post('/node/jenkins/start')
188188
.send(fixture)
189189
.expect(400, 'Will only push builds related to pull requests')
190190
.end((err, res) => {
191-
t.equal(err, null)
191+
t.assert.strictEqual(err, null)
192192
})
193193
})
194194

195-
tap.test('Responds with 400 / "Bad request" when build ended status update is not related to a pull request', (t) => {
195+
test('Responds with 400 / "Bad request" when build ended status update is not related to a pull request', (t) => {
196196
const fixture = readFixture('jenkins-staging-failure-payload.json')
197197

198198
// don't care about the results, just want to prevent any HTTP request ever being made
199199
fetchMock.route('https://api.github.com/', 200)
200200

201-
t.plan(1)
201+
t.plan(1, { wait: 2000 })
202202

203203
supertest(app)
204204
.post('/node/jenkins/end')
205205
.send(fixture)
206206
.expect(400, 'Will only push builds related to pull requests')
207207
.end((err, res) => {
208-
t.equal(err, null)
208+
t.assert.strictEqual(err, null)
209209
})
210210
})
211211

212-
tap.test('Responds with 400 / "Bad request" when incoming providing invalid repository name', (t) => {
212+
test('Responds with 400 / "Bad request" when incoming providing invalid repository name', (t) => {
213213
const fixture = readFixture('pending-payload.json')
214214

215215
// don't care about the results, just want to prevent any HTTP request ever being made
216216
fetchMock.route('https://api.github.com/', 200)
217217

218-
t.plan(1)
218+
t.plan(1, { wait: 2000 })
219219

220220
supertest(app)
221221
.post('/not-valid-repo-name/jenkins/start')
222222
.send(fixture)
223223
.expect(400, 'Invalid repository')
224224
.end((err, res) => {
225-
t.equal(err, null)
225+
t.assert.strictEqual(err, null)
226226
})
227227
})
228228

‎test/unit/node-owners.test.js

+28-28
Original file line numberDiff line numberDiff line change
@@ -1,87 +1,87 @@
1-
import tap from 'tap'
1+
import test from 'node:test'
22

33
import { Owners } from '../../lib/node-owners.js'
44
import readFixture from '../read-fixture.js'
55

66
const ownersFile = readFixture('CODEOWNERS')
77

8-
tap.test('single file single team match', (t) => {
8+
test('single file single team match', (t, done) => {
99
const owners = Owners.fromFile(ownersFile)
10-
t.strictSame(
10+
t.assert.deepStrictEqual(
1111
owners.getOwnersForPaths(['file1']),
1212
['@nodejs/test1']
1313
)
14-
t.end()
14+
done()
1515
})
1616

17-
tap.test('double file single team match', (t) => {
17+
test('double file single team match', (t, done) => {
1818
const owners = Owners.fromFile(ownersFile)
19-
t.strictSame(
19+
t.assert.deepStrictEqual(
2020
owners.getOwnersForPaths(['file1', 'file4']),
2121
['@nodejs/test1']
2222
)
23-
t.end()
23+
done()
2424
})
2525

26-
tap.test('double file double individual team match', (t) => {
26+
test('double file double individual team match', (t, done) => {
2727
const owners = Owners.fromFile(ownersFile)
28-
t.strictSame(
28+
t.assert.deepStrictEqual(
2929
owners.getOwnersForPaths(['file1', 'file2']),
3030
['@nodejs/test1', '@nodejs/test2']
3131
)
32-
t.end()
32+
done()
3333
})
3434

35-
tap.test('single file double team match', (t) => {
35+
test('single file double team match', (t, done) => {
3636
const owners = Owners.fromFile(ownersFile)
37-
t.strictSame(
37+
t.assert.deepStrictEqual(
3838
owners.getOwnersForPaths(['file3']),
3939
['@nodejs/test1', '@nodejs/test2']
4040
)
41-
t.end()
41+
done()
4242
})
4343

44-
tap.test('double file triple team match (1 + 2)', (t) => {
44+
test('double file triple team match (1 + 2)', (t, done) => {
4545
const owners = Owners.fromFile(ownersFile)
46-
t.strictSame(
46+
t.assert.deepStrictEqual(
4747
owners.getOwnersForPaths(['file5', 'file3']),
4848
['@nodejs/test1', '@nodejs/test2', '@nodejs/test3']
4949
)
50-
t.end()
50+
done()
5151
})
5252

53-
tap.test('folder match', (t) => {
53+
test('folder match', (t, done) => {
5454
const owners = Owners.fromFile(ownersFile)
55-
t.strictSame(
55+
t.assert.deepStrictEqual(
5656
owners.getOwnersForPaths(['folder1/file5']),
5757
['@nodejs/test3']
5858
)
59-
t.end()
59+
done()
6060
})
6161

62-
tap.test('extension match', (t) => {
62+
test('extension match', (t, done) => {
6363
const owners = Owners.fromFile(ownersFile)
64-
t.strictSame(
64+
t.assert.deepStrictEqual(
6565
owners.getOwnersForPaths(['folder2/file1.js']),
6666
['@nodejs/test4', '@nodejs/test5']
6767
)
68-
t.end()
68+
done()
6969
})
7070

71-
tap.test('no match', (t) => {
71+
test('no match', (t, done) => {
7272
const owners = Owners.fromFile(ownersFile)
73-
t.strictSame(
73+
t.assert.deepStrictEqual(
7474
owners.getOwnersForPaths(['unknown']),
7575
[]
7676
)
77-
t.end()
77+
done()
7878
})
7979

80-
tap.test('no match + single match', (t) => {
80+
test('no match + single match', (t, done) => {
8181
const owners = Owners.fromFile(ownersFile)
82-
t.strictSame(
82+
t.assert.deepStrictEqual(
8383
owners.getOwnersForPaths(['unknown', 'file1']),
8484
['@nodejs/test1']
8585
)
86-
t.end()
86+
done()
8787
})

‎test/unit/node-repo-owners.test.js

+28-38
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import tap from 'tap'
1+
import test from 'node:test'
22
import fetchMock from 'fetch-mock'
33
import nock from 'nock'
44

@@ -16,19 +16,19 @@ const {
1616

1717
fetchMock.mockGlobal()
1818

19-
tap.test('getCodeOwnersUrl', (t) => {
19+
test('getCodeOwnersUrl', (t, done) => {
2020
const owner = 'nodejs'
2121
const repo = 'node-auto-test'
2222
const defaultBranch = 'main'
2323

24-
t.equal(
24+
t.assert.strictEqual(
2525
getCodeOwnersUrl(owner, repo, defaultBranch),
2626
`https://raw.githubusercontent.com/${owner}/${repo}/${defaultBranch}/.github/CODEOWNERS`
2727
)
28-
t.end()
28+
done()
2929
})
3030

31-
tap.test('listFiles success', async (t) => {
31+
test('listFiles success', async (t) => {
3232
const options = {
3333
owner: 'nodejs',
3434
repo: 'node-auto-test',
@@ -44,12 +44,11 @@ tap.test('listFiles success', async (t) => {
4444
fetchMock.route(urlPattern, fixture)
4545

4646
const files = await listFiles(options)
47-
t.strictSame(files, fixture.map(({ filename }) => filename))
48-
t.equal(fetchMock.callHistory.called(urlPattern), true)
49-
t.end()
47+
t.assert.deepStrictEqual(files, fixture.map(({ filename }) => filename))
48+
t.assert.strictEqual(fetchMock.callHistory.called(urlPattern), true)
5049
})
5150

52-
tap.test('listFiles fail', async (t) => {
51+
test('listFiles fail', async (t) => {
5352
const options = {
5453
owner: 'nodejs',
5554
repo: 'node-auto-test',
@@ -63,12 +62,11 @@ tap.test('listFiles fail', async (t) => {
6362
const urlPattern = `https://api.github.com/repos/${options.owner}/${options.repo}/pulls/${options.prId}/files`
6463
fetchMock.route(urlPattern, 500)
6564

66-
await t.rejects(listFiles(options))
67-
t.equal(fetchMock.callHistory.called(urlPattern), true)
68-
t.end()
65+
await t.assert.rejects(listFiles(options))
66+
t.assert.strictEqual(fetchMock.callHistory.called(urlPattern), true)
6967
})
7068

71-
tap.test('getDefaultBranch success', async (t) => {
69+
test('getDefaultBranch success', async (t) => {
7270
const options = {
7371
owner: 'nodejs',
7472
repo: 'node-auto-test-2',
@@ -84,12 +82,11 @@ tap.test('getDefaultBranch success', async (t) => {
8482
fetchMock.route(urlPattern, fixture)
8583

8684
const defaultBranch = await getDefaultBranch(options)
87-
t.strictSame(defaultBranch, fixture.default_branch)
88-
t.equal(fetchMock.callHistory.called(urlPattern), true)
89-
t.end()
85+
t.assert.deepStrictEqual(defaultBranch, fixture.default_branch)
86+
t.assert.strictEqual(fetchMock.callHistory.called(urlPattern), true)
9087
})
9188

92-
tap.test('getDefaultBranch empty response', async (t) => {
89+
test('getDefaultBranch empty response', async (t) => {
9390
const options = {
9491
owner: 'nodejs',
9592
repo: 'node-auto-test-3',
@@ -104,12 +101,11 @@ tap.test('getDefaultBranch empty response', async (t) => {
104101

105102
fetchMock.route(urlPattern, 200)
106103

107-
await t.rejects(getDefaultBranch(options))
108-
t.equal(fetchMock.callHistory.called(), true)
109-
t.end()
104+
await t.assert.rejects(getDefaultBranch(options))
105+
t.assert.strictEqual(fetchMock.callHistory.called(), true)
110106
})
111107

112-
tap.test('getDefaultBranch fail', async (t) => {
108+
test('getDefaultBranch fail', async (t) => {
113109
const options = {
114110
owner: 'nodejs',
115111
repo: 'node-auto-test-4',
@@ -123,12 +119,11 @@ tap.test('getDefaultBranch fail', async (t) => {
123119
const urlPattern = `https://api.github.com/repos/${options.owner}/${options.repo}`
124120
fetchMock.route(urlPattern, 500)
125121

126-
await t.rejects(getDefaultBranch(options))
127-
t.equal(fetchMock.callHistory.called(), true)
128-
t.end()
122+
await t.assert.rejects(getDefaultBranch(options))
123+
t.assert.strictEqual(fetchMock.callHistory.called(), true)
129124
})
130125

131-
tap.test('getCodeOwnersFile success', async (t) => {
126+
test('getCodeOwnersFile success', async (t) => {
132127
const options = {
133128
owner: 'nodejs',
134129
repo: 'node-auto-test-5',
@@ -148,12 +143,11 @@ tap.test('getCodeOwnersFile success', async (t) => {
148143
.reply(200, fixture)
149144

150145
const file = await getCodeOwnersFile(url, options)
151-
t.strictSame(file, fixture)
146+
t.assert.deepStrictEqual(file, fixture)
152147
scope.done()
153-
t.end()
154148
})
155149

156-
tap.test('getCodeOwnersFile fail', async (t) => {
150+
test('getCodeOwnersFile fail', async (t) => {
157151
const options = {
158152
owner: 'nodejs',
159153
repo: 'node-auto-test-6',
@@ -171,12 +165,11 @@ tap.test('getCodeOwnersFile fail', async (t) => {
171165
.get(filePath)
172166
.reply(500)
173167

174-
await t.rejects(getCodeOwnersFile(url, options))
168+
await t.assert.rejects(getCodeOwnersFile(url, options))
175169
scope.done()
176-
t.end()
177170
})
178171

179-
tap.test('pingOwners success', async (t) => {
172+
test('pingOwners success', async (t) => {
180173
const options = {
181174
owner: 'nodejs',
182175
repo: 'node-auto-test-6',
@@ -206,10 +199,9 @@ tap.test('pingOwners success', async (t) => {
206199

207200
await pingOwners(options, owners)
208201
fetchMock.callHistory.called(url)
209-
t.end()
210202
})
211203

212-
tap.test('pingOwners fail', async (t) => {
204+
test('pingOwners fail', async (t) => {
213205
const options = {
214206
owner: 'nodejs',
215207
repo: 'node-auto-test-6',
@@ -223,12 +215,11 @@ tap.test('pingOwners fail', async (t) => {
223215
const url = `https://api.github.com/repos/${options.owner}/${options.repo}/issues/${options.prId}/comments`
224216
fetchMock.route({ url, method: 'POST' }, 500)
225217

226-
await t.rejects(pingOwners(options, []))
218+
await t.assert.rejects(pingOwners(options, []))
227219
fetchMock.callHistory.called(url)
228-
t.end()
229220
})
230221

231-
tap.test('resolveOwnersThenPingPr success', async (t) => {
222+
test('resolveOwnersThenPingPr success', async (t) => {
232223
const options = {
233224
owner: 'nodejs',
234225
repo: 'node-auto-test',
@@ -269,7 +260,6 @@ tap.test('resolveOwnersThenPingPr success', async (t) => {
269260

270261
await resolveOwnersThenPingPr(options, owners)
271262

272-
t.equal(fetchMock.callHistory.called(), true)
263+
t.assert.strictEqual(fetchMock.callHistory.called(), true)
273264
scope.done()
274-
t.end()
275265
})

‎test/unit/node-repo.test.js

+12-12
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import tap from 'tap'
1+
import test from 'node:test'
22
import fetchMock from 'fetch-mock'
33

44
import * as nodeRepo from '../../lib/node-repo.js'
@@ -8,7 +8,7 @@ import readFixture from '../read-fixture.js'
88

99
fetchMock.mockGlobal()
1010

11-
tap.test('getBotPrLabels(): returns labels added by nodejs-github-bot', (t) => {
11+
test('getBotPrLabels(): returns labels added by nodejs-github-bot', (t) => {
1212
const events = readFixture('pull-request-events.json')
1313

1414
const owner = 'nodejs'
@@ -17,15 +17,15 @@ tap.test('getBotPrLabels(): returns labels added by nodejs-github-bot', (t) => {
1717
const urlPattern = `glob:https://api.github.com/repos/${owner}/${repo}/issues/${prId}/events?*`
1818

1919
fetchMock.route(urlPattern, events.data)
20-
t.plan(2)
20+
t.plan(2, { wait: true })
2121

2222
nodeRepo.getBotPrLabels({ owner, repo, prId }, (_, labels) => {
23-
t.same(labels, ['testlabel'])
24-
t.equal(fetchMock.callHistory.called(urlPattern), true)
23+
t.assert.deepStrictEqual(labels, ['testlabel'])
24+
t.assert.strictEqual(fetchMock.callHistory.called(urlPattern), true)
2525
})
2626
})
2727

28-
tap.test('getBotPrLabels(): returns net labels added/removed by nodejs-github-bot', (t) => {
28+
test('getBotPrLabels(): returns net labels added/removed by nodejs-github-bot', (t) => {
2929
const events = readFixture('pull-request-events-2.json')
3030

3131
const owner = 'nodejs'
@@ -37,15 +37,15 @@ tap.test('getBotPrLabels(): returns net labels added/removed by nodejs-github-bo
3737
urlPattern,
3838
events.data
3939
)
40-
t.plan(2)
40+
t.plan(2, { wait: true })
4141

4242
nodeRepo.getBotPrLabels({ owner, repo, prId }, (_, labels) => {
43-
t.same(labels, [])
44-
t.equal(fetchMock.callHistory.called(urlPattern), true)
43+
t.assert.deepStrictEqual(labels, [])
44+
t.assert.strictEqual(fetchMock.callHistory.called(urlPattern), true)
4545
})
4646
})
4747

48-
tap.test('removeLabelFromPR(): should remove label', async (t) => {
48+
test('removeLabelFromPR(): should remove label', async (t) => {
4949
const owner = 'nodejs'
5050
const repo = 'node7'
5151
const prId = '3'
@@ -59,6 +59,6 @@ tap.test('removeLabelFromPR(): should remove label', async (t) => {
5959
t.plan(2)
6060

6161
const response = await nodeRepo.removeLabelFromPR({ owner, repo, prId, logger }, label)
62-
t.same(label, response)
63-
t.equal(fetchMock.callHistory.called(urlPattern), true)
62+
t.assert.deepStrictEqual(label, response)
63+
t.assert.strictEqual(fetchMock.callHistory.called(urlPattern), true)
6464
})

‎test/unit/push-jenkins-update.test.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
import tap from 'tap'
1+
import test from 'node:test'
22

33
import { findLatestCommitInPr } from '../../lib/push-jenkins-update.js'
44

55
import fetchMock from 'fetch-mock'
66
import readFixture from '../read-fixture.js'
77

8-
tap.test('findLatestCommitInPr: paginates results when more than 100 commits in a PR', async (t) => {
8+
test('findLatestCommitInPr: paginates results when more than 100 commits in a PR', async (t) => {
99
const commitsFixturePage1 = readFixture('pull-request-commits-page-1.json')
1010
const commitsFixturePage2 = readFixture('pull-request-commits-page-2.json')
1111
const commitsFixturePage3 = readFixture('pull-request-commits-page-3.json')
@@ -59,7 +59,7 @@ tap.test('findLatestCommitInPr: paginates results when more than 100 commits in
5959
t.plan(1)
6060

6161
const commit = await findLatestCommitInPr({ owner, repo, pr })
62-
t.equal(commit.sha, 'c1aa949064892dbe693750686c06f4ad5673e577')
62+
t.assert.strictEqual(commit.sha, 'c1aa949064892dbe693750686c06f4ad5673e577')
6363
firstPageScope.callHistory.called()
6464
secondPageScope.callHistory.called()
6565
thirdPageScope.callHistory.called()

0 commit comments

Comments
 (0)
Please sign in to comment.