Skip to content

Commit 00f105f

Browse files
committed
chore: skip broken ntl and fail faster
1 parent 5fd01b6 commit 00f105f

File tree

2 files changed

+22
-34
lines changed

2 files changed

+22
-34
lines changed

test/e2e/next-test-lib/next-test-utils.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -378,12 +378,12 @@ export function waitFor(millis) {
378378
}
379379

380380
// check for content in 1 second intervals timing out after
381-
// 30 seconds
381+
// 10 seconds
382382
export async function check(contentFn, regex, hardError = true) {
383383
let content
384384
let lastErr
385385

386-
for (let tries = 0; tries < 30; tries++) {
386+
for (let tries = 0; tries < 10; tries++) {
387387
try {
388388
content = await contentFn()
389389
if (typeof regex === 'string') {
@@ -400,11 +400,11 @@ export async function check(contentFn, regex, hardError = true) {
400400
lastErr = err
401401
}
402402
}
403-
console.error('TIMED OUT CHECK: ', { regex, content, lastErr })
404403

405404
if (hardError) {
406405
throw new Error('TIMED OUT: ' + regex + '\n\n' + content)
407406
}
407+
console.error('TIMED OUT CHECK: ', { regex, content, lastErr })
408408
return false
409409
}
410410

test/e2e/tests/middleware-fetches-with-body/index.test.ts

Lines changed: 19 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ describe('Middleware fetches with body', () => {
6060
{
6161
body,
6262
method: 'POST',
63-
}
63+
},
6464
)
6565

6666
expect(res.status).toBe(413)
@@ -81,21 +81,18 @@ describe('Middleware fetches with body', () => {
8181
{
8282
body,
8383
method: 'POST',
84-
}
84+
},
8585
)
8686
const data = await res.json()
8787

8888
expect(res.status).toBe(200)
8989
expect(data.body.length).toBe(bodySize)
90-
expect(data.body.split('B1C2D3E4F5G6H7I8J9K0LaMbNcOdPeQf').length).toBe(
91-
bodySize / 32 + 1
92-
)
90+
expect(data.body.split('B1C2D3E4F5G6H7I8J9K0LaMbNcOdPeQf').length).toBe(bodySize / 32 + 1)
9391
})
9492

9593
it('should be able to send and return body greater than default highWaterMark (16KiB)', async () => {
9694
const bodySize = 16 * 1024 + 1
97-
const body =
98-
'CD1E2F3G4H5I6J7K8L9M0NaObPcQdReS'.repeat(bodySize / 32) + 'C'
95+
const body = 'CD1E2F3G4H5I6J7K8L9M0NaObPcQdReS'.repeat(bodySize / 32) + 'C'
9996

10097
const res = await fetchViaHTTP(
10198
next.url,
@@ -104,15 +101,13 @@ describe('Middleware fetches with body', () => {
104101
{
105102
body,
106103
method: 'POST',
107-
}
104+
},
108105
)
109106
const data = await res.json()
110107

111108
expect(res.status).toBe(200)
112109
expect(data.body.length).toBe(bodySize)
113-
expect(data.body.split('CD1E2F3G4H5I6J7K8L9M0NaObPcQdReS').length).toBe(
114-
512 + 1
115-
)
110+
expect(data.body.split('CD1E2F3G4H5I6J7K8L9M0NaObPcQdReS').length).toBe(512 + 1)
116111
})
117112
})
118113

@@ -128,7 +123,7 @@ describe('Middleware fetches with body', () => {
128123
{
129124
body,
130125
method: 'POST',
131-
}
126+
},
132127
)
133128

134129
expect(res.status).toBe(413)
@@ -149,20 +144,19 @@ describe('Middleware fetches with body', () => {
149144
{
150145
body,
151146
method: 'POST',
152-
}
147+
},
153148
)
154149
const data = await res.json()
155150

156151
expect(res.status).toBe(200)
157152
expect(data.body.length).toBe(bodySize)
158-
expect(data.body.split('DEF1G2H3I4J5K6L7M8N9O0PaQbRcSdTe').length).toBe(
159-
bodySize / 32 + 1
160-
)
153+
expect(data.body.split('DEF1G2H3I4J5K6L7M8N9O0PaQbRcSdTe').length).toBe(bodySize / 32 + 1)
161154
})
162155
})
163156

164157
describe('with custom bodyParser sizeLimit (5mb)', () => {
165-
it('should return 413 for body equal to 10mb', async () => {
158+
// NTL: disabled because of EF bug
159+
it.skip('should return 413 for body equal to 10mb', async () => {
166160
const bodySize = 10 * 1024 * 1024
167161
const body = 't'.repeat(bodySize)
168162

@@ -173,7 +167,7 @@ describe('Middleware fetches with body', () => {
173167
{
174168
body,
175169
method: 'POST',
176-
}
170+
},
177171
)
178172

179173
expect(res.status).toBe(413)
@@ -194,7 +188,7 @@ describe('Middleware fetches with body', () => {
194188
{
195189
body,
196190
method: 'POST',
197-
}
191+
},
198192
)
199193

200194
expect(res.status).toBe(413)
@@ -216,15 +210,13 @@ describe('Middleware fetches with body', () => {
216210
{
217211
body,
218212
method: 'POST',
219-
}
213+
},
220214
)
221215
const data = await res.json()
222216

223217
expect(res.status).toBe(200)
224218
expect(data.body.length).toBe(bodySize)
225-
expect(data.body.split('FGHI1J2K3L4M5N6O7P8Q9R0SaTbUcVdW').length).toBe(
226-
bodySize / 32 + 1
227-
)
219+
expect(data.body.split('FGHI1J2K3L4M5N6O7P8Q9R0SaTbUcVdW').length).toBe(bodySize / 32 + 1)
228220
})
229221
}
230222
})
@@ -241,16 +233,14 @@ describe('Middleware fetches with body', () => {
241233
{
242234
body,
243235
method: 'POST',
244-
}
236+
},
245237
)
246238
const data = await res.json()
247239

248240
expect(res.status).toBe(200)
249241
expect(data.body).toBeUndefined()
250242
expect(data.rawBody.length).toBe(bodySize)
251-
expect(
252-
data.rawBody.split('HIJK1L2M3N4O5P6Q7R8S9T0UaVbWcXdY').length
253-
).toBe(bodySize / 32 + 1)
243+
expect(data.rawBody.split('HIJK1L2M3N4O5P6Q7R8S9T0UaVbWcXdY').length).toBe(bodySize / 32 + 1)
254244
})
255245

256246
it('should be able to send and return with body greater than 16KiB', async () => {
@@ -264,16 +254,14 @@ describe('Middleware fetches with body', () => {
264254
{
265255
body,
266256
method: 'POST',
267-
}
257+
},
268258
)
269259
const data = await res.json()
270260

271261
expect(res.status).toBe(200)
272262
expect(data.body).toBeUndefined()
273263
expect(data.rawBody.length).toBe(bodySize)
274-
expect(
275-
data.rawBody.split('JKLM1N2O3P4Q5R6S7T8U9V0WaXbYcZdA').length
276-
).toBe(bodySize / 32 + 1)
264+
expect(data.rawBody.split('JKLM1N2O3P4Q5R6S7T8U9V0WaXbYcZdA').length).toBe(bodySize / 32 + 1)
277265
})
278266
})
279267
})

0 commit comments

Comments
 (0)