Unverified Commit c74f3f54 authored by JJ Kasper's avatar JJ Kasper Committed by GitHub

Update flakey module-errors test (#68494)

Looks like this can have a race condition of editing the test file and
booting the dev server

x-ref:
https://github.com/vercel/next.js/actions/runs/10231169480/job/28307684614?pr=68492
x-ref:
https://github.com/vercel/next.js/actions/runs/10230130942/job/28304603462?pr=68449
parent 677c9b37
...@@ -4,13 +4,13 @@ ...@@ -4,13 +4,13 @@
import { remove } from 'fs-extra' import { remove } from 'fs-extra'
import { join } from 'path' import { join } from 'path'
import { import {
check,
fetchViaHTTP, fetchViaHTTP,
findPort, findPort,
killApp, killApp,
launchApp, launchApp,
nextBuild, nextBuild,
nextStart, nextStart,
retry,
} from 'next-test-utils' } from 'next-test-utils'
import { import {
context, context,
...@@ -85,14 +85,12 @@ describe('Edge runtime code with imports', () => { ...@@ -85,14 +85,12 @@ describe('Edge runtime code with imports', () => {
it('throws unsupported module error in dev at runtime and highlights the faulty line', async () => { it('throws unsupported module error in dev at runtime and highlights the faulty line', async () => {
context.app = await launchApp(context.appDir, context.appPort, appOption) context.app = await launchApp(context.appDir, context.appPort, appOption)
const res = await fetchViaHTTP(context.appPort, url) await retry(async () => {
expect(res.status).toBe(500) const res = await fetchViaHTTP(context.appPort, url)
expect(res.status).toBe(500)
const text = await res.text() const text = await res.text()
await check(async () => {
expectUnsupportedModuleDevError(moduleName, importStatement, text) expectUnsupportedModuleDevError(moduleName, importStatement, text)
return 'success' })
}, 'success')
}) })
;(process.env.TURBOPACK_DEV ? describe.skip : describe)( ;(process.env.TURBOPACK_DEV ? describe.skip : describe)(
'production mode', 'production mode',
...@@ -152,14 +150,13 @@ describe('Edge runtime code with imports', () => { ...@@ -152,14 +150,13 @@ describe('Edge runtime code with imports', () => {
it('throws not-found module error in dev at runtime and highlights the faulty line', async () => { it('throws not-found module error in dev at runtime and highlights the faulty line', async () => {
context.app = await launchApp(context.appDir, context.appPort, appOption) context.app = await launchApp(context.appDir, context.appPort, appOption)
const res = await fetchViaHTTP(context.appPort, url) await retry(async () => {
expect(res.status).toBe(500) const res = await fetchViaHTTP(context.appPort, url)
expect(res.status).toBe(500)
const text = await res.text() const text = await res.text()
await check(async () => {
expectModuleNotFoundDevError(moduleName, importStatement, text) expectModuleNotFoundDevError(moduleName, importStatement, text)
return 'success' })
}, 'success')
}) })
;(process.env.TURBOPACK_DEV ? describe.skip : describe)( ;(process.env.TURBOPACK_DEV ? describe.skip : describe)(
'production mode', 'production mode',
...@@ -218,14 +215,13 @@ describe('Edge runtime code with imports', () => { ...@@ -218,14 +215,13 @@ describe('Edge runtime code with imports', () => {
it('throws not-found module error in dev at runtime and highlights the faulty line', async () => { it('throws not-found module error in dev at runtime and highlights the faulty line', async () => {
context.app = await launchApp(context.appDir, context.appPort, appOption) context.app = await launchApp(context.appDir, context.appPort, appOption)
const res = await fetchViaHTTP(context.appPort, url) await retry(async () => {
expect(res.status).toBe(500) const res = await fetchViaHTTP(context.appPort, url)
expect(res.status).toBe(500)
const text = await res.text() const text = await res.text()
await check(async () => {
expectModuleNotFoundDevError(moduleName, importStatement, text) expectModuleNotFoundDevError(moduleName, importStatement, text)
return 'success' })
}, 'success')
}) })
;(process.env.TURBOPACK_DEV ? describe.skip : describe)( ;(process.env.TURBOPACK_DEV ? describe.skip : describe)(
'production mode', 'production mode',
...@@ -285,9 +281,11 @@ describe('Edge runtime code with imports', () => { ...@@ -285,9 +281,11 @@ describe('Edge runtime code with imports', () => {
it('does not throw in dev at runtime', async () => { it('does not throw in dev at runtime', async () => {
context.app = await launchApp(context.appDir, context.appPort, appOption) context.app = await launchApp(context.appDir, context.appPort, appOption)
const res = await fetchViaHTTP(context.appPort, url) await retry(async () => {
expect(res.status).toBe(200) const res = await fetchViaHTTP(context.appPort, url)
expectNoError(moduleName) expect(res.status).toBe(200)
expectNoError(moduleName)
})
}) })
;(process.env.TURBOPACK_DEV ? describe.skip : describe)( ;(process.env.TURBOPACK_DEV ? describe.skip : describe)(
'production mode', 'production mode',
......
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