1- import tap from 'tap '
1+ import test from 'node:test '
22import fetchMock from 'fetch-mock'
33import supertest from 'supertest'
44
@@ -13,7 +13,7 @@ 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 , done ) => {
1717 const jenkinsPayload = readFixture ( 'success-payload.json' )
1818
1919 const listCommitsUrl = setupListCommitsMock ( 'node' )
@@ -28,13 +28,14 @@ tap.test('Sends POST requests to https://api.github.com/repos/nodejs/node/status
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 )
34+ done ( )
3435 } )
3536} )
3637
37- tap . test ( 'Allows repository name to be provided with URL parameter when pushing job started' , ( t ) => {
38+ test ( 'Allows repository name to be provided with URL parameter when pushing job started' , ( t , done ) => {
3839 const jenkinsPayload = readFixture ( 'pending-payload.json' )
3940
4041 const listCommitsUrl = setupListCommitsMock ( 'citgm' )
@@ -49,13 +50,14 @@ tap.test('Allows repository name to be provided with URL parameter when pushing
4950 . send ( jenkinsPayload )
5051 . expect ( 200 )
5152 . end ( ( err , res ) => {
52- t . equal ( err , null )
53- t . equal ( fetchMock . callHistory . called ( url ) , true )
54- t . equal ( fetchMock . callHistory . called ( listCommitsUrl ) , true )
53+ t . assert . strictEqual ( err , null )
54+ t . assert . strictEqual ( fetchMock . callHistory . called ( url ) , true )
55+ t . assert . strictEqual ( fetchMock . callHistory . called ( listCommitsUrl ) , true )
56+ done ( )
5557 } )
5658} )
5759
58- tap . test ( 'Allows repository name to be provided with URL parameter when pushing job ended' , ( t ) => {
60+ test ( 'Allows repository name to be provided with URL parameter when pushing job ended' , ( t , done ) => {
5961 const jenkinsPayload = readFixture ( 'success-payload.json' )
6062
6163 const listCommitsUrl = setupListCommitsMock ( 'citgm' )
@@ -70,13 +72,14 @@ tap.test('Allows repository name to be provided with URL parameter when pushing
7072 . send ( jenkinsPayload )
7173 . expect ( 200 )
7274 . end ( ( err , res ) => {
73- t . equal ( err , null )
74- t . equal ( fetchMock . callHistory . called ( url ) , true )
75- t . equal ( fetchMock . callHistory . called ( listCommitsUrl ) , true )
75+ t . assert . strictEqual ( err , null )
76+ t . assert . strictEqual ( fetchMock . callHistory . called ( url ) , true )
77+ t . assert . strictEqual ( fetchMock . callHistory . called ( listCommitsUrl ) , true )
78+ done ( )
7679 } )
7780} )
7881
79- tap . test ( 'Forwards payload provided in incoming POST to GitHub status API' , ( t ) => {
82+ test ( 'Forwards payload provided in incoming POST to GitHub status API' , ( t , done ) => {
8083 const fixture = readFixture ( 'success-payload.json' )
8184
8285 const listCommitsUrl = setupListCommitsMock ( 'node' )
@@ -97,13 +100,14 @@ tap.test('Forwards payload provided in incoming POST to GitHub status API', (t)
97100 . send ( fixture )
98101 . expect ( 200 )
99102 . end ( ( err , res ) => {
100- t . equal ( err , null )
101- t . equal ( fetchMock . callHistory . called ( url ) , true )
102- t . equal ( fetchMock . callHistory . called ( listCommitsUrl ) , true )
103+ t . assert . strictEqual ( err , null )
104+ t . assert . strictEqual ( fetchMock . callHistory . called ( url ) , true )
105+ t . assert . strictEqual ( fetchMock . callHistory . called ( listCommitsUrl ) , true )
106+ done ( )
103107 } )
104108} )
105109
106- tap . test ( 'Posts a CI comment in the related PR when Jenkins build is named node-test-pull-request' , ( t ) => {
110+ test ( 'Posts a CI comment in the related PR when Jenkins build is named node-test-pull-request' , ( t , done ) => {
107111 const fixture = readFixture ( 'jenkins-test-pull-request-success-payload.json' )
108112
109113 const url = 'https://api.github.com/repos/nodejs/node/issues/12345/comments'
@@ -125,12 +129,13 @@ tap.test('Posts a CI comment in the related PR when Jenkins build is named node-
125129 . send ( fixture )
126130 . expect ( 200 )
127131 . end ( ( err , res ) => {
128- t . equal ( fetchMock . callHistory . called ( url ) , true )
129- t . equal ( err , null )
132+ t . assert . strictEqual ( fetchMock . callHistory . called ( url ) , true )
133+ t . assert . strictEqual ( err , null )
134+ done ( )
130135 } )
131136} )
132137
133- tap . test ( 'Posts a CI comment in the related PR when Jenkins build is named node-test-pull-request-lite-pipeline' , ( t ) => {
138+ test ( 'Posts a CI comment in the related PR when Jenkins build is named node-test-pull-request-lite-pipeline' , ( t , done ) => {
134139 const fixture = readFixture ( 'jenkins-test-pull-request-success-payload.json' )
135140 fixture . identifier = 'node-test-pull-request-lite-pipeline'
136141
@@ -153,12 +158,13 @@ tap.test('Posts a CI comment in the related PR when Jenkins build is named node-
153158 . send ( fixture )
154159 . expect ( 200 )
155160 . end ( ( err , res ) => {
156- t . equal ( fetchMock . callHistory . called ( url ) , true )
157- t . equal ( err , null )
161+ t . assert . strictEqual ( fetchMock . callHistory . called ( url ) , true )
162+ t . assert . strictEqual ( err , null )
163+ done ( )
158164 } )
159165} )
160166
161- tap . test ( 'Responds with 400 / "Bad request" when incoming request has invalid payload' , ( t ) => {
167+ test ( 'Responds with 400 / "Bad request" when incoming request has invalid payload' , ( t , done ) => {
162168 const fixture = readFixture ( 'invalid-payload.json' )
163169
164170 // don't care about the results, just want to prevent any HTTP request ever being made
@@ -171,11 +177,12 @@ tap.test('Responds with 400 / "Bad request" when incoming request has invalid pa
171177 . send ( fixture )
172178 . expect ( 400 , 'Invalid payload' )
173179 . end ( ( err , res ) => {
174- t . equal ( err , null )
180+ t . assert . strictEqual ( err , null )
181+ done ( )
175182 } )
176183} )
177184
178- tap . test ( 'Responds with 400 / "Bad request" when build started status update is not related to a pull request' , ( t ) => {
185+ test ( 'Responds with 400 / "Bad request" when build started status update is not related to a pull request' , ( t , done ) => {
179186 const fixture = readFixture ( 'jenkins-staging-failure-payload.json' )
180187
181188 // don't care about the results, just want to prevent any HTTP request ever being made
@@ -188,11 +195,12 @@ tap.test('Responds with 400 / "Bad request" when build started status update is
188195 . send ( fixture )
189196 . expect ( 400 , 'Will only push builds related to pull requests' )
190197 . end ( ( err , res ) => {
191- t . equal ( err , null )
198+ t . assert . strictEqual ( err , null )
199+ done ( )
192200 } )
193201} )
194202
195- tap . test ( 'Responds with 400 / "Bad request" when build ended status update is not related to a pull request' , ( t ) => {
203+ test ( 'Responds with 400 / "Bad request" when build ended status update is not related to a pull request' , ( t , done ) => {
196204 const fixture = readFixture ( 'jenkins-staging-failure-payload.json' )
197205
198206 // don't care about the results, just want to prevent any HTTP request ever being made
@@ -205,11 +213,12 @@ tap.test('Responds with 400 / "Bad request" when build ended status update is no
205213 . send ( fixture )
206214 . expect ( 400 , 'Will only push builds related to pull requests' )
207215 . end ( ( err , res ) => {
208- t . equal ( err , null )
216+ t . assert . strictEqual ( err , null )
217+ done ( )
209218 } )
210219} )
211220
212- tap . test ( 'Responds with 400 / "Bad request" when incoming providing invalid repository name' , ( t ) => {
221+ test ( 'Responds with 400 / "Bad request" when incoming providing invalid repository name' , ( t , done ) => {
213222 const fixture = readFixture ( 'pending-payload.json' )
214223
215224 // don't care about the results, just want to prevent any HTTP request ever being made
@@ -222,7 +231,8 @@ tap.test('Responds with 400 / "Bad request" when incoming providing invalid repo
222231 . send ( fixture )
223232 . expect ( 400 , 'Invalid repository' )
224233 . end ( ( err , res ) => {
225- t . equal ( err , null )
234+ t . assert . strictEqual ( err , null )
235+ done ( )
226236 } )
227237} )
228238
0 commit comments