Skip to content

Commit f81e681

Browse files
authored
Update flakey tests (#70643)
Investigating failing tests on `14-2-1` branch
1 parent 50e41a2 commit f81e681

File tree

4 files changed

+116
-102
lines changed

4 files changed

+116
-102
lines changed

.github/workflows/build_and_test.yml

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -215,29 +215,30 @@ jobs:
215215

216216
secrets: inherit
217217

218-
test-new-tests-dev:
219-
name: Test new tests for flakes (dev)
220-
needs: ['changes', 'build-native', 'build-next']
221-
if: ${{ needs.changes.outputs.docs-only == 'false' }}
218+
# disabled for backport branch
219+
# test-new-tests-dev:
220+
# name: Test new tests for flakes (dev)
221+
# needs: ['changes', 'build-native', 'build-next']
222+
# if: ${{ needs.changes.outputs.docs-only == 'false' }}
222223

223-
uses: ./.github/workflows/build_reusable.yml
224-
with:
225-
afterBuild: node scripts/test-new-tests.mjs --dev-mode
226-
stepName: 'test-new-tests-dev'
224+
# uses: ./.github/workflows/build_reusable.yml
225+
# with:
226+
# afterBuild: node scripts/test-new-tests.mjs --dev-mode
227+
# stepName: 'test-new-tests-dev'
227228

228-
secrets: inherit
229+
# secrets: inherit
229230

230-
test-new-tests-start:
231-
name: Test new tests for flakes (prod)
232-
needs: ['changes', 'build-native', 'build-next']
233-
if: ${{ needs.changes.outputs.docs-only == 'false' }}
231+
# test-new-tests-start:
232+
# name: Test new tests for flakes (prod)
233+
# needs: ['changes', 'build-native', 'build-next']
234+
# if: ${{ needs.changes.outputs.docs-only == 'false' }}
234235

235-
uses: ./.github/workflows/build_reusable.yml
236-
with:
237-
afterBuild: node scripts/test-new-tests.mjs --prod-mode
238-
stepName: 'test-new-tests-start'
236+
# uses: ./.github/workflows/build_reusable.yml
237+
# with:
238+
# afterBuild: node scripts/test-new-tests.mjs --prod-mode
239+
# stepName: 'test-new-tests-start'
239240

240-
secrets: inherit
241+
# secrets: inherit
241242

242243
test-dev:
243244
name: test dev
@@ -309,8 +310,7 @@ jobs:
309310
secrets: inherit
310311

311312
tests-pass:
312-
needs:
313-
[
313+
needs: [
314314
'build-native',
315315
'build-next',
316316
'lint',
@@ -325,8 +325,8 @@ jobs:
325325
'test-next-swc-wasm',
326326
'test-turbopack-dev',
327327
'test-turbopack-integration',
328-
'test-new-tests-dev',
329-
'test-new-tests-start',
328+
# 'test-new-tests-dev',
329+
# 'test-new-tests-start',
330330
]
331331

332332
if: always()

test/development/basic/hmr.test.ts

Lines changed: 70 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -877,83 +877,92 @@ describe.each([
877877
}
878878
})
879879

880-
it('should recover after loader parse error in an imported file', async () => {
881-
let browser
882-
const aboutPage = join('pages', 'hmr', 'about9.js')
880+
// assertion is highly flakey in turbopack mode
881+
if (!process.env.TURBOPACK) {
882+
it('should recover after loader parse error in an imported file', async () => {
883+
let browser
884+
const aboutPage = join('pages', 'hmr', 'about9.js')
883885

884-
const aboutContent = await next.readFile(aboutPage)
885-
try {
886-
browser = await webdriver(next.appPort, basePath + '/hmr/about9')
887-
await check(() => getBrowserBodyText(browser), /This is the about page/)
886+
const aboutContent = await next.readFile(aboutPage)
887+
try {
888+
browser = await webdriver(next.appPort, basePath + '/hmr/about9')
889+
await check(
890+
() => getBrowserBodyText(browser),
891+
/This is the about page/
892+
)
888893

889-
await next.patchFile(
890-
aboutPage,
891-
aboutContent.replace(
892-
'export default',
893-
'import "../../components/parse-error.js"\nexport default'
894+
await next.patchFile(
895+
aboutPage,
896+
aboutContent.replace(
897+
'export default',
898+
'import "../../components/parse-error.js"\nexport default'
899+
)
894900
)
895-
)
896901

897-
expect(await hasRedbox(browser)).toBe(true)
898-
expect(await getRedboxHeader(browser)).toMatch('Failed to compile')
899-
let redboxSource = await getRedboxSource(browser)
902+
expect(await hasRedbox(browser)).toBe(true)
903+
expect(await getRedboxHeader(browser)).toMatch('Failed to compile')
904+
let redboxSource = await getRedboxSource(browser)
905+
906+
redboxSource = redboxSource.replace(`${next.testDir}`, '.')
907+
if (process.env.TURBOPACK) {
908+
expect(next.normalizeTestDirContent(redboxSource))
909+
.toMatchInlineSnapshot(`
910+
"./components/parse-error.js:3:1
911+
Parsing ecmascript source code failed
912+
1 | This
913+
2 | is
914+
> 3 | }}}
915+
| ^
916+
4 | invalid
917+
5 | js
918+
919+
Expression expected"
920+
`)
921+
} else {
922+
redboxSource = redboxSource.substring(
923+
0,
924+
redboxSource.indexOf('`----')
925+
)
900926

901-
redboxSource = redboxSource.replace(`${next.testDir}`, '.')
902-
if (process.env.TURBOPACK) {
903-
expect(next.normalizeTestDirContent(redboxSource))
904-
.toMatchInlineSnapshot(`
905-
"./components/parse-error.js:3:1
906-
Parsing ecmascript source code failed
927+
expect(next.normalizeTestDirContent(redboxSource))
928+
.toMatchInlineSnapshot(`
929+
"./components/parse-error.js
930+
Error:
931+
x Expression expected
932+
,-[./components/parse-error.js:1:1]
907933
1 | This
908934
2 | is
909-
> 3 | }}}
910-
| ^
935+
3 | }}}
936+
: ^
911937
4 | invalid
912938
5 | js
939+
"
940+
`)
941+
}
913942

914-
Expression expected"
915-
`)
916-
} else {
917-
redboxSource = redboxSource.substring(
918-
0,
919-
redboxSource.indexOf('`----')
920-
)
921-
922-
expect(next.normalizeTestDirContent(redboxSource))
923-
.toMatchInlineSnapshot(`
924-
"./components/parse-error.js
925-
Error:
926-
x Expression expected
927-
,-[./components/parse-error.js:1:1]
928-
1 | This
929-
2 | is
930-
3 | }}}
931-
: ^
932-
4 | invalid
933-
5 | js
934-
"
935-
`)
936-
}
937-
938-
await next.patchFile(aboutPage, aboutContent)
939-
940-
await check(() => getBrowserBodyText(browser), /This is the about page/)
941-
expect(await hasRedbox(browser)).toBe(false)
942-
} catch (err) {
943-
await next.patchFile(aboutPage, aboutContent)
943+
await next.patchFile(aboutPage, aboutContent)
944944

945-
if (browser) {
946945
await check(
947946
() => getBrowserBodyText(browser),
948947
/This is the about page/
949948
)
949+
expect(await hasRedbox(browser)).toBe(false)
950+
} catch (err) {
951+
await next.patchFile(aboutPage, aboutContent)
952+
953+
if (browser) {
954+
await check(
955+
() => getBrowserBodyText(browser),
956+
/This is the about page/
957+
)
958+
}
959+
} finally {
960+
if (browser) {
961+
await browser.close()
962+
}
950963
}
951-
} finally {
952-
if (browser) {
953-
await browser.close()
954-
}
955-
}
956-
})
964+
})
965+
}
957966

958967
it('should recover from errors in getInitialProps in client', async () => {
959968
let browser

test/development/basic/node-builtins/app/server-component/page.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ import tty from 'tty'
1919
import util from 'util'
2020
import zlib from 'zlib'
2121

22-
import '_http_common'
2322
import 'setimmediate'
2423

2524
async function getData() {

test/integration/eslint/test/next-lint.test.js

Lines changed: 24 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -29,33 +29,39 @@ const mjsCjsLinting = join(__dirname, '../mjs-cjs-linting')
2929
const dirTypescript = join(__dirname, '../with-typescript')
3030

3131
describe('Next Lint', () => {
32-
describe('First Time Setup ', () => {
32+
const folders = []
33+
afterAll(async () => {
34+
for (const folder of folders) {
35+
await fs.remove(folder)
36+
}
37+
})
38+
39+
// these are flaking on 14-2-1
40+
describe.skip('First Time Setup ', () => {
3341
async function nextLintTemp(setupCallback, isApp = false) {
3442
const folder = join(os.tmpdir(), Math.random().toString(36).substring(2))
43+
folders.push(folder)
44+
3545
await fs.mkdirp(folder)
3646
await fs.copy(join(dirNoConfig, isApp ? 'app' : ''), folder)
3747
await setupCallback?.(folder)
3848

39-
try {
40-
const { stdout, stderr } = await nextLint(folder, ['--strict'], {
41-
stderr: true,
42-
stdout: true,
43-
cwd: folder,
44-
})
49+
const { stdout, stderr } = await nextLint(folder, ['--strict'], {
50+
stderr: true,
51+
stdout: true,
52+
cwd: folder,
53+
})
4554

46-
console.log({ stdout, stderr })
55+
console.log({ stdout, stderr })
4756

48-
const pkgJson = JSON.parse(
49-
await fs.readFile(join(folder, 'package.json'), 'utf8')
50-
)
51-
const eslintrcJson = JSON.parse(
52-
await fs.readFile(join(folder, '.eslintrc.json'), 'utf8')
53-
)
57+
const pkgJson = JSON.parse(
58+
await fs.readFile(join(folder, 'package.json'), 'utf8')
59+
)
60+
const eslintrcJson = JSON.parse(
61+
await fs.readFile(join(folder, '.eslintrc.json'), 'utf8')
62+
)
5463

55-
return { stdout, pkgJson, eslintrcJson }
56-
} finally {
57-
await fs.remove(folder)
58-
}
64+
return { stdout, pkgJson, eslintrcJson }
5965
}
6066

6167
test('show a prompt to set up ESLint if no configuration detected', async () => {

0 commit comments

Comments
 (0)