Skip to content

Commit 190faf4

Browse files
committed
Fully skip flakey assertion
1 parent 3020a11 commit 190faf4

File tree

1 file changed

+42
-50
lines changed

1 file changed

+42
-50
lines changed

test/development/basic/hmr.test.ts

+42-50
Original file line numberDiff line numberDiff line change
@@ -879,36 +879,32 @@ describe.each([
879879
}
880880
})
881881

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

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

896-
await next.patchFile(
897-
aboutPage,
898-
aboutContent.replace(
899-
'export default',
900-
'import "../../components/parse-error.js"\nexport default'
901-
)
892+
await next.patchFile(
893+
aboutPage,
894+
aboutContent.replace(
895+
'export default',
896+
'import "../../components/parse-error.js"\nexport default'
902897
)
898+
)
903899

904-
expect(await hasRedbox(browser)).toBe(true)
905-
expect(await getRedboxHeader(browser)).toMatch('Failed to compile')
906-
let redboxSource = await getRedboxSource(browser)
900+
expect(await hasRedbox(browser)).toBe(true)
901+
expect(await getRedboxHeader(browser)).toMatch('Failed to compile')
902+
let redboxSource = await getRedboxSource(browser)
907903

908-
redboxSource = redboxSource.replace(`${next.testDir}`, '.')
909-
if (process.env.TURBOPACK) {
910-
expect(next.normalizeTestDirContent(redboxSource))
911-
.toMatchInlineSnapshot(`
904+
redboxSource = redboxSource.replace(`${next.testDir}`, '.')
905+
if (process.env.TURBOPACK) {
906+
expect(next.normalizeTestDirContent(redboxSource))
907+
.toMatchInlineSnapshot(`
912908
"./components/parse-error.js:3:1
913909
Parsing ecmascript source code failed
914910
1 | This
@@ -920,14 +916,14 @@ describe.each([
920916
921917
Expression expected"
922918
`)
923-
} else {
924-
redboxSource = redboxSource.substring(
925-
0,
926-
redboxSource.indexOf('`----')
927-
)
919+
} else {
920+
redboxSource = redboxSource.substring(
921+
0,
922+
redboxSource.indexOf('`----')
923+
)
928924

929-
expect(next.normalizeTestDirContent(redboxSource))
930-
.toMatchInlineSnapshot(`
925+
expect(next.normalizeTestDirContent(redboxSource))
926+
.toMatchInlineSnapshot(`
931927
"./components/parse-error.js
932928
Error:
933929
x Expression expected
@@ -940,31 +936,27 @@ describe.each([
940936
5 | js
941937
"
942938
`)
943-
}
939+
}
944940

945-
await next.patchFile(aboutPage, aboutContent)
941+
await next.patchFile(aboutPage, aboutContent)
946942

943+
await check(() => getBrowserBodyText(browser), /This is the about page/)
944+
expect(await hasRedbox(browser)).toBe(false)
945+
} catch (err) {
946+
await next.patchFile(aboutPage, aboutContent)
947+
948+
if (browser) {
947949
await check(
948950
() => getBrowserBodyText(browser),
949951
/This is the about page/
950952
)
951-
expect(await hasRedbox(browser)).toBe(false)
952-
} catch (err) {
953-
await next.patchFile(aboutPage, aboutContent)
954-
955-
if (browser) {
956-
await check(
957-
() => getBrowserBodyText(browser),
958-
/This is the about page/
959-
)
960-
}
961-
} finally {
962-
if (browser) {
963-
await browser.close()
964-
}
965953
}
966-
})
967-
}
954+
} finally {
955+
if (browser) {
956+
await browser.close()
957+
}
958+
}
959+
})
968960

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

0 commit comments

Comments
 (0)