Commit 190faf4d authored by JJ Kasper's avatar JJ Kasper

Fully skip flakey assertion

parent 3020a118
...@@ -879,36 +879,32 @@ describe.each([ ...@@ -879,36 +879,32 @@ describe.each([
} }
}) })
// assertion is highly flakey in turbopack mode // assertion is highly flakey
if (!process.env.TURBOPACK) { it.skip('should recover after loader parse error in an imported file', async () => {
it('should recover after loader parse error in an imported file', async () => { let browser
let browser const aboutPage = join('pages', 'hmr', 'about9.js')
const aboutPage = join('pages', 'hmr', 'about9.js')
const aboutContent = await next.readFile(aboutPage) const aboutContent = await next.readFile(aboutPage)
try { try {
browser = await webdriver(next.appPort, basePath + '/hmr/about9') browser = await webdriver(next.appPort, basePath + '/hmr/about9')
await check( await check(() => getBrowserBodyText(browser), /This is the about page/)
() => getBrowserBodyText(browser),
/This is the about page/
)
await next.patchFile( await next.patchFile(
aboutPage, aboutPage,
aboutContent.replace( aboutContent.replace(
'export default', 'export default',
'import "../../components/parse-error.js"\nexport default' 'import "../../components/parse-error.js"\nexport default'
)
) )
)
expect(await hasRedbox(browser)).toBe(true) expect(await hasRedbox(browser)).toBe(true)
expect(await getRedboxHeader(browser)).toMatch('Failed to compile') expect(await getRedboxHeader(browser)).toMatch('Failed to compile')
let redboxSource = await getRedboxSource(browser) let redboxSource = await getRedboxSource(browser)
redboxSource = redboxSource.replace(`${next.testDir}`, '.') redboxSource = redboxSource.replace(`${next.testDir}`, '.')
if (process.env.TURBOPACK) { if (process.env.TURBOPACK) {
expect(next.normalizeTestDirContent(redboxSource)) expect(next.normalizeTestDirContent(redboxSource))
.toMatchInlineSnapshot(` .toMatchInlineSnapshot(`
"./components/parse-error.js:3:1 "./components/parse-error.js:3:1
Parsing ecmascript source code failed Parsing ecmascript source code failed
1 | This 1 | This
...@@ -920,14 +916,14 @@ describe.each([ ...@@ -920,14 +916,14 @@ describe.each([
Expression expected" Expression expected"
`) `)
} else { } else {
redboxSource = redboxSource.substring( redboxSource = redboxSource.substring(
0, 0,
redboxSource.indexOf('`----') redboxSource.indexOf('`----')
) )
expect(next.normalizeTestDirContent(redboxSource)) expect(next.normalizeTestDirContent(redboxSource))
.toMatchInlineSnapshot(` .toMatchInlineSnapshot(`
"./components/parse-error.js "./components/parse-error.js
Error: Error:
x Expression expected x Expression expected
...@@ -940,31 +936,27 @@ describe.each([ ...@@ -940,31 +936,27 @@ describe.each([
5 | js 5 | js
" "
`) `)
} }
await next.patchFile(aboutPage, aboutContent) await next.patchFile(aboutPage, aboutContent)
await check(() => getBrowserBodyText(browser), /This is the about page/)
expect(await hasRedbox(browser)).toBe(false)
} catch (err) {
await next.patchFile(aboutPage, aboutContent)
if (browser) {
await check( await check(
() => getBrowserBodyText(browser), () => getBrowserBodyText(browser),
/This is the about page/ /This is the about page/
) )
expect(await hasRedbox(browser)).toBe(false)
} catch (err) {
await next.patchFile(aboutPage, aboutContent)
if (browser) {
await check(
() => getBrowserBodyText(browser),
/This is the about page/
)
}
} finally {
if (browser) {
await browser.close()
}
} }
}) } finally {
} if (browser) {
await browser.close()
}
}
})
it('should recover from errors in getInitialProps in client', async () => { it('should recover from errors in getInitialProps in client', async () => {
let browser let browser
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment