diff --git a/test/development/acceptance-app/ReactRefreshRegression.test.ts b/test/development/acceptance-app/ReactRefreshRegression.test.ts index 00ee9d6a798b2..d7314adc1a6f6 100644 --- a/test/development/acceptance-app/ReactRefreshRegression.test.ts +++ b/test/development/acceptance-app/ReactRefreshRegression.test.ts @@ -335,11 +335,14 @@ describe('ReactRefreshRegression app', () => { }) // https://github.com/vercel/next.js/issues/13574 - test('custom loader mdx should have Fast Refresh enabled', async () => { - const files = new Map() - files.set( - 'next.config.js', - outdent` + // Test is skipped with Turbopack as the package uses webpack loaders + ;(process.env.TURBOPACK ? test.skip : test)( + 'custom loader mdx should have Fast Refresh enabled', + async () => { + const files = new Map() + files.set( + 'next.config.js', + outdent` const withMDX = require("@next/mdx")({ extension: /\\.mdx?$/, }); @@ -347,44 +350,45 @@ describe('ReactRefreshRegression app', () => { pageExtensions: ["js", "mdx"], }); ` - ) - files.set('app/content.mdx', `Hello World!`) - files.set( - 'app/page.js', - outdent` + ) + files.set('app/content.mdx', `Hello World!`) + files.set( + 'app/page.js', + outdent` 'use client' import MDX from './content.mdx' export default function Page() { return
} ` - ) - - const { session, cleanup } = await sandbox(next, files) - expect( - await session.evaluate( - () => document.querySelector('#content').textContent - ) - ).toBe('Hello World!') - - let didNotReload = await session.patch('app/content.mdx', `Hello Foo!`) - expect(didNotReload).toBe(true) - expect(await session.hasRedbox(false)).toBe(false) - expect( - await session.evaluate( - () => document.querySelector('#content').textContent ) - ).toBe('Hello Foo!') - didNotReload = await session.patch('app/content.mdx', `Hello Bar!`) - expect(didNotReload).toBe(true) - expect(await session.hasRedbox(false)).toBe(false) - expect( - await session.evaluate( - () => document.querySelector('#content').textContent - ) - ).toBe('Hello Bar!') - - await cleanup() - }) + const { session, cleanup } = await sandbox(next, files) + expect( + await session.evaluate( + () => document.querySelector('#content').textContent + ) + ).toBe('Hello World!') + + let didNotReload = await session.patch('app/content.mdx', `Hello Foo!`) + expect(didNotReload).toBe(true) + expect(await session.hasRedbox(false)).toBe(false) + expect( + await session.evaluate( + () => document.querySelector('#content').textContent + ) + ).toBe('Hello Foo!') + + didNotReload = await session.patch('app/content.mdx', `Hello Bar!`) + expect(didNotReload).toBe(true) + expect(await session.hasRedbox(false)).toBe(false) + expect( + await session.evaluate( + () => document.querySelector('#content').textContent + ) + ).toBe('Hello Bar!') + + await cleanup() + } + ) }) diff --git a/test/development/acceptance/ReactRefreshRegression.test.ts b/test/development/acceptance/ReactRefreshRegression.test.ts index 9f295a0c320fa..d60ed0950c6af 100644 --- a/test/development/acceptance/ReactRefreshRegression.test.ts +++ b/test/development/acceptance/ReactRefreshRegression.test.ts @@ -295,13 +295,16 @@ describe('ReactRefreshRegression', () => { }) // https://github.com/vercel/next.js/issues/13574 - test('custom loader (mdx) should have Fast Refresh enabled', async () => { - const { session, cleanup } = await sandbox( - next, - new Map([ - [ - 'next.config.js', - outdent` + // Test is skipped with Turbopack as the package uses webpack loaders + ;(process.env.TURBOPACK ? test.skip : test)( + 'custom loader (mdx) should have Fast Refresh enabled', + async () => { + const { session, cleanup } = await sandbox( + next, + new Map([ + [ + 'next.config.js', + outdent` const withMDX = require("@next/mdx")({ extension: /\\.mdx?$/, }); @@ -309,35 +312,36 @@ describe('ReactRefreshRegression', () => { pageExtensions: ["js", "mdx"], }); `, - ], - ['pages/mdx.mdx', `Hello World!`], - ]), - '/mdx' - ) - expect( - await session.evaluate( - () => document.querySelector('#__next').textContent + ], + ['pages/mdx.mdx', `Hello World!`], + ]), + '/mdx' ) - ).toBe('Hello World!') - - let didNotReload = await session.patch('pages/mdx.mdx', `Hello Foo!`) - expect(didNotReload).toBe(true) - expect(await session.hasRedbox(false)).toBe(false) - expect( - await session.evaluate( - () => document.querySelector('#__next').textContent - ) - ).toBe('Hello Foo!') - - didNotReload = await session.patch('pages/mdx.mdx', `Hello Bar!`) - expect(didNotReload).toBe(true) - expect(await session.hasRedbox(false)).toBe(false) - expect( - await session.evaluate( - () => document.querySelector('#__next').textContent - ) - ).toBe('Hello Bar!') - - await cleanup() - }) + expect( + await session.evaluate( + () => document.querySelector('#__next').textContent + ) + ).toBe('Hello World!') + + let didNotReload = await session.patch('pages/mdx.mdx', `Hello Foo!`) + expect(didNotReload).toBe(true) + expect(await session.hasRedbox(false)).toBe(false) + expect( + await session.evaluate( + () => document.querySelector('#__next').textContent + ) + ).toBe('Hello Foo!') + + didNotReload = await session.patch('pages/mdx.mdx', `Hello Bar!`) + expect(didNotReload).toBe(true) + expect(await session.hasRedbox(false)).toBe(false) + expect( + await session.evaluate( + () => document.querySelector('#__next').textContent + ) + ).toBe('Hello Bar!') + + await cleanup() + } + ) })