1- import tap from 'tap '
1+ import test from 'node:test '
22import fetchMock from 'fetch-mock'
33import supertest from 'supertest'
44
@@ -13,70 +13,70 @@ fetchMock.mockGlobal()
1313
1414jenkinsStatus ( 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
0 commit comments