1
- import tap from 'tap '
1
+ import test from 'node:test '
2
2
import fetchMock from 'fetch-mock'
3
3
import supertest from 'supertest'
4
4
@@ -13,7 +13,7 @@ fetchMock.mockGlobal()
13
13
14
14
jenkinsStatus ( app , events )
15
15
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 ) => {
17
17
const jenkinsPayload = readFixture ( 'success-payload.json' )
18
18
19
19
const listCommitsUrl = setupListCommitsMock ( 'node' )
@@ -28,13 +28,14 @@ tap.test('Sends POST requests to https://api.github.com/repos/nodejs/node/status
28
28
. send ( jenkinsPayload )
29
29
. expect ( 200 )
30
30
. 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 ( )
34
35
} )
35
36
} )
36
37
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 ) => {
38
39
const jenkinsPayload = readFixture ( 'pending-payload.json' )
39
40
40
41
const listCommitsUrl = setupListCommitsMock ( 'citgm' )
@@ -49,13 +50,14 @@ tap.test('Allows repository name to be provided with URL parameter when pushing
49
50
. send ( jenkinsPayload )
50
51
. expect ( 200 )
51
52
. 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 ( )
55
57
} )
56
58
} )
57
59
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 ) => {
59
61
const jenkinsPayload = readFixture ( 'success-payload.json' )
60
62
61
63
const listCommitsUrl = setupListCommitsMock ( 'citgm' )
@@ -70,13 +72,14 @@ tap.test('Allows repository name to be provided with URL parameter when pushing
70
72
. send ( jenkinsPayload )
71
73
. expect ( 200 )
72
74
. 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 ( )
76
79
} )
77
80
} )
78
81
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 ) => {
80
83
const fixture = readFixture ( 'success-payload.json' )
81
84
82
85
const listCommitsUrl = setupListCommitsMock ( 'node' )
@@ -97,13 +100,14 @@ tap.test('Forwards payload provided in incoming POST to GitHub status API', (t)
97
100
. send ( fixture )
98
101
. expect ( 200 )
99
102
. 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 ( )
103
107
} )
104
108
} )
105
109
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 ) => {
107
111
const fixture = readFixture ( 'jenkins-test-pull-request-success-payload.json' )
108
112
109
113
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-
125
129
. send ( fixture )
126
130
. expect ( 200 )
127
131
. 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 ( )
130
135
} )
131
136
} )
132
137
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 ) => {
134
139
const fixture = readFixture ( 'jenkins-test-pull-request-success-payload.json' )
135
140
fixture . identifier = 'node-test-pull-request-lite-pipeline'
136
141
@@ -153,12 +158,13 @@ tap.test('Posts a CI comment in the related PR when Jenkins build is named node-
153
158
. send ( fixture )
154
159
. expect ( 200 )
155
160
. 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 ( )
158
164
} )
159
165
} )
160
166
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 ) => {
162
168
const fixture = readFixture ( 'invalid-payload.json' )
163
169
164
170
// 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
171
177
. send ( fixture )
172
178
. expect ( 400 , 'Invalid payload' )
173
179
. end ( ( err , res ) => {
174
- t . equal ( err , null )
180
+ t . assert . strictEqual ( err , null )
181
+ done ( )
175
182
} )
176
183
} )
177
184
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 ) => {
179
186
const fixture = readFixture ( 'jenkins-staging-failure-payload.json' )
180
187
181
188
// 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
188
195
. send ( fixture )
189
196
. expect ( 400 , 'Will only push builds related to pull requests' )
190
197
. end ( ( err , res ) => {
191
- t . equal ( err , null )
198
+ t . assert . strictEqual ( err , null )
199
+ done ( )
192
200
} )
193
201
} )
194
202
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 ) => {
196
204
const fixture = readFixture ( 'jenkins-staging-failure-payload.json' )
197
205
198
206
// 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
205
213
. send ( fixture )
206
214
. expect ( 400 , 'Will only push builds related to pull requests' )
207
215
. end ( ( err , res ) => {
208
- t . equal ( err , null )
216
+ t . assert . strictEqual ( err , null )
217
+ done ( )
209
218
} )
210
219
} )
211
220
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 ) => {
213
222
const fixture = readFixture ( 'pending-payload.json' )
214
223
215
224
// 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
222
231
. send ( fixture )
223
232
. expect ( 400 , 'Invalid repository' )
224
233
. end ( ( err , res ) => {
225
- t . equal ( err , null )
234
+ t . assert . strictEqual ( err , null )
235
+ done ( )
226
236
} )
227
237
} )
228
238
0 commit comments