Unverified Commit bd9b11e9 authored by Hendrik Liebau's avatar Hendrik Liebau Committed by GitHub

Put flaky `use-cache-unknown-cache-kind` dev tests in sandboxes (#76171)

Apparently the HMR changes in the one dev test are affecting the others,
or vice versa. So we put them in sandboxes to hopefully avoid the
resulting flakiness.
parent c43d73dd
...@@ -8,6 +8,7 @@ import { ...@@ -8,6 +8,7 @@ import {
retry, retry,
} from 'next-test-utils' } from 'next-test-utils'
import stripAnsi from 'strip-ansi' import stripAnsi from 'strip-ansi'
import { createSandbox } from 'development-sandbox'
const nextConfigWithCacheHandler: NextConfig = { const nextConfigWithCacheHandler: NextConfig = {
experimental: { experimental: {
...@@ -88,12 +89,14 @@ describe('use-cache-unknown-cache-kind', () => { ...@@ -88,12 +89,14 @@ describe('use-cache-unknown-cache-kind', () => {
}) })
} else { } else {
it('should not show an error for default cache kinds', async () => { it('should not show an error for default cache kinds', async () => {
const browser = await next.browser('/remote') await using sandbox = await createSandbox(next, undefined, '/remote')
const { browser } = sandbox
await assertNoRedbox(browser) await assertNoRedbox(browser)
}) })
it('should show a build error', async () => { it('should show a build error', async () => {
const browser = await next.browser('/') await using sandbox = await createSandbox(next, undefined, '/')
const { browser } = sandbox
await assertHasRedbox(browser) await assertHasRedbox(browser)
...@@ -161,19 +164,20 @@ describe('use-cache-unknown-cache-kind', () => { ...@@ -161,19 +164,20 @@ describe('use-cache-unknown-cache-kind', () => {
}) })
it('should recover from the build error if the cache handler is defined', async () => { it('should recover from the build error if the cache handler is defined', async () => {
const browser = await next.browser('/') await using sandbox = await createSandbox(next, undefined, '/')
const { browser, session } = sandbox
await assertHasRedbox(browser) await assertHasRedbox(browser)
await next.patchFile( await session.patch(
'next.config.js', 'next.config.js',
`module.exports = ${JSON.stringify(nextConfigWithCacheHandler)}`, `module.exports = ${JSON.stringify(nextConfigWithCacheHandler)}`
() => )
retry(async () => {
await retry(async () => {
expect(await browser.elementByCss('p').text()).toBe('hello world') expect(await browser.elementByCss('p').text()).toBe('hello world')
await assertNoRedbox(browser) await assertNoRedbox(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