From bb0ed863a2d32e5f9d255c5723c57f853db628ce Mon Sep 17 00:00:00 2001 From: Tim Neutkens Date: Thu, 15 Aug 2024 22:00:53 +0200 Subject: [PATCH] Turbopack build: Skip CSS test that checks webpack behavior (#68935) ## What? Skips a test that checks webpack specific behavior. --- .../css/test/css-rendering.test.js | 132 +++++++++--------- test/turbopack-build-tests-manifest.json | 7 +- 2 files changed, 72 insertions(+), 67 deletions(-) diff --git a/test/integration/css/test/css-rendering.test.js b/test/integration/css/test/css-rendering.test.js index ad04b6cb27e96..ea522f4a607e8 100644 --- a/test/integration/css/test/css-rendering.test.js +++ b/test/integration/css/test/css-rendering.test.js @@ -228,14 +228,17 @@ module.exports = { ) }) - describe('CSS Cleanup on Render Failure', () => { - const appDir = join(fixturesDir, 'transition-cleanup') - const nextConfig = new File(join(appDir, 'next.config.js')) + // Turbopack keeps styles which mirrors development with webpack. This test only checks a behavior for webpack. + ;(process.env.TURBOPACK ? describe.skip : describe)( + 'CSS Cleanup on Render Failure', + () => { + const appDir = join(fixturesDir, 'transition-cleanup') + const nextConfig = new File(join(appDir, 'next.config.js')) - describe.each([true, false])(`useLightnincsss(%s)`, (useLightningcss) => { - beforeAll(async () => { - nextConfig.write( - ` + describe.each([true, false])(`useLightnincsss(%s)`, (useLightningcss) => { + beforeAll(async () => { + nextConfig.write( + ` const config = require('../next.config.js'); module.exports = { ...config, @@ -243,73 +246,74 @@ module.exports = { useLightningcss: ${useLightningcss} } }` - ) - }) - - let app, appPort - - function tests() { - async function checkBlackTitle(browser) { - await browser.waitForElementByCss('#black-title') - const titleColor = await browser.eval( - `window.getComputedStyle(document.querySelector('#black-title')).color` ) - expect(titleColor).toBe('rgb(17, 17, 17)') - } + }) - it('not have intermediary page styles on error rendering', async () => { - const browser = await webdriver(appPort, '/') - try { - await checkBlackTitle(browser) + let app, appPort - const currentPageStyles = await browser.eval( - `document.querySelector('link[rel=stylesheet][data-n-p]')` + function tests() { + async function checkBlackTitle(browser) { + await browser.waitForElementByCss('#black-title') + const titleColor = await browser.eval( + `window.getComputedStyle(document.querySelector('#black-title')).color` ) - expect(currentPageStyles).toBeDefined() + expect(titleColor).toBe('rgb(17, 17, 17)') + } - // Navigate to other: - await browser.waitForElementByCss('#link-other').click() - await check( - () => browser.eval(`document.body.innerText`), - 'Application error: a client-side exception has occurred (see the browser console for more information).', - true - ) + it('not have intermediary page styles on error rendering', async () => { + const browser = await webdriver(appPort, '/') + try { + await checkBlackTitle(browser) - const newPageStyles = await browser.eval( - `document.querySelector('link[rel=stylesheet][data-n-p]')` - ) - expect(newPageStyles).toBeFalsy() + const currentPageStyles = await browser.eval( + `document.querySelector('link[rel=stylesheet][data-n-p]')` + ) + expect(currentPageStyles).toBeDefined() + + // Navigate to other: + await browser.waitForElementByCss('#link-other').click() + await check( + () => browser.eval(`document.body.innerText`), + 'Application error: a client-side exception has occurred (see the browser console for more information).', + true + ) - const allPageStyles = await browser.eval( - `document.querySelector('link[rel=stylesheet]')` - ) - expect(allPageStyles).toBeFalsy() - } finally { - await browser.close() - } - }) - } + const newPageStyles = await browser.eval( + `document.querySelector('link[rel=stylesheet][data-n-p]')` + ) + expect(newPageStyles).toBeFalsy() - ;(process.env.TURBOPACK_DEV ? describe.skip : describe)( - 'production mode', - () => { - beforeAll(async () => { - await remove(join(appDir, '.next')) - }) - beforeAll(async () => { - await nextBuild(appDir, [], {}) - appPort = await findPort() - app = await nextStart(appDir, appPort) - }) - afterAll(async () => { - await killApp(app) + const allPageStyles = await browser.eval( + `document.querySelector('link[rel=stylesheet]')` + ) + expect(allPageStyles).toBeFalsy() + } finally { + await browser.close() + } }) - - tests() } - ) - }) - }) + + ;(process.env.TURBOPACK_DEV ? describe.skip : describe)( + 'production mode', + () => { + beforeAll(async () => { + await remove(join(appDir, '.next')) + }) + beforeAll(async () => { + await nextBuild(appDir, [], {}) + appPort = await findPort() + app = await nextStart(appDir, appPort) + }) + afterAll(async () => { + await killApp(app) + }) + + tests() + } + ) + }) + } + ) describe('Page reload on CSS missing', () => { const appDir = join(fixturesDir, 'transition-reload') diff --git a/test/turbopack-build-tests-manifest.json b/test/turbopack-build-tests-manifest.json index af7aafd3dc100..13715bff2265e 100644 --- a/test/turbopack-build-tests-manifest.json +++ b/test/turbopack-build-tests-manifest.json @@ -7952,12 +7952,13 @@ "CSS Support production mode CSS Import from node_modules useLightnincsss(true) should fail the build" ], "failed": [ - "CSS Support CSS Cleanup on Render Failure useLightnincsss(false) production mode not have intermediary page styles on error rendering", - "CSS Support CSS Cleanup on Render Failure useLightnincsss(true) production mode not have intermediary page styles on error rendering", "CSS Support Page reload on CSS missing useLightnincsss(false) production mode should fall back to server-side transition on missing CSS", "CSS Support Page reload on CSS missing useLightnincsss(true) production mode should fall back to server-side transition on missing CSS" ], - "pending": [], + "pending": [ + "CSS Support CSS Cleanup on Render Failure useLightnincsss(false) production mode not have intermediary page styles on error rendering", + "CSS Support CSS Cleanup on Render Failure useLightnincsss(true) production mode not have intermediary page styles on error rendering" + ], "flakey": [], "runtimeError": false },