Unverified Commit bb0ed863 authored by Tim Neutkens's avatar Tim Neutkens Committed by GitHub

Turbopack build: Skip CSS test that checks webpack behavior (#68935)

## What?

Skips a test that checks webpack specific behavior.

<!-- Thanks for opening a PR! Your contribution is much appreciated.
To make sure your PR is handled as smoothly as possible we request that
you follow the checklist sections below.
Choose the right checklist for the change(s) that you're making:

## For Contributors

### Improving Documentation

- Run `pnpm prettier-fix` to fix formatting issues before opening the
PR.
- Read the Docs Contribution Guide to ensure your contribution follows
the docs guidelines:
https://nextjs.org/docs/community/contribution-guide

### Adding or Updating Examples

- The "examples guidelines" are followed from our contributing doc
https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md
- Make sure the linting passes by running `pnpm build && pnpm lint`. See
https://github.com/vercel/next.js/blob/canary/contributing/repository/linting.md

### Fixing a bug

- Related issues linked using `fixes #number`
- Tests added. See:
https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs
- Errors have a helpful link attached, see
https://github.com/vercel/next.js/blob/canary/contributing.md

### Adding a feature

- Implements an existing feature request or RFC. Make sure the feature
request has been accepted for implementation before opening a PR. (A
discussion must be opened, see
https://github.com/vercel/next.js/discussions/new?category=ideas)
- Related issues/discussions are linked using `fixes #number`
- e2e tests added
(https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs)
- Documentation added
- Telemetry added. In case of a feature if it's used or not.
- Errors have a helpful link attached, see
https://github.com/vercel/next.js/blob/canary/contributing.md


## For Maintainers

- Minimal description (aim for explaining to someone not on the team to
understand the PR)
- When linking to a Slack thread, you might want to share details of the
conclusion
- Link both the Linear (Fixes NEXT-xxx) and the GitHub issues
- Add review comments if necessary to explain to the reviewer the logic
behind a change

### What?

### Why?

### How?

Closes NEXT-
Fixes #

-->
parent a4438fe8
...@@ -228,14 +228,17 @@ module.exports = { ...@@ -228,14 +228,17 @@ module.exports = {
) )
}) })
describe('CSS Cleanup on Render Failure', () => { // Turbopack keeps styles which mirrors development with webpack. This test only checks a behavior for webpack.
const appDir = join(fixturesDir, 'transition-cleanup') ;(process.env.TURBOPACK ? describe.skip : describe)(
const nextConfig = new File(join(appDir, 'next.config.js')) '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) => { describe.each([true, false])(`useLightnincsss(%s)`, (useLightningcss) => {
beforeAll(async () => { beforeAll(async () => {
nextConfig.write( nextConfig.write(
` `
const config = require('../next.config.js'); const config = require('../next.config.js');
module.exports = { module.exports = {
...config, ...config,
...@@ -243,73 +246,74 @@ module.exports = { ...@@ -243,73 +246,74 @@ module.exports = {
useLightningcss: ${useLightningcss} 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 () => { let app, appPort
const browser = await webdriver(appPort, '/')
try {
await checkBlackTitle(browser)
const currentPageStyles = await browser.eval( function tests() {
`document.querySelector('link[rel=stylesheet][data-n-p]')` 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: it('not have intermediary page styles on error rendering', async () => {
await browser.waitForElementByCss('#link-other').click() const browser = await webdriver(appPort, '/')
await check( try {
() => browser.eval(`document.body.innerText`), await checkBlackTitle(browser)
'Application error: a client-side exception has occurred (see the browser console for more information).',
true
)
const newPageStyles = await browser.eval( const currentPageStyles = await browser.eval(
`document.querySelector('link[rel=stylesheet][data-n-p]')` `document.querySelector('link[rel=stylesheet][data-n-p]')`
) )
expect(newPageStyles).toBeFalsy() 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( const newPageStyles = await browser.eval(
`document.querySelector('link[rel=stylesheet]')` `document.querySelector('link[rel=stylesheet][data-n-p]')`
) )
expect(allPageStyles).toBeFalsy() expect(newPageStyles).toBeFalsy()
} finally {
await browser.close()
}
})
}
;(process.env.TURBOPACK_DEV ? describe.skip : describe)( const allPageStyles = await browser.eval(
'production mode', `document.querySelector('link[rel=stylesheet]')`
() => { )
beforeAll(async () => { expect(allPageStyles).toBeFalsy()
await remove(join(appDir, '.next')) } finally {
}) await browser.close()
beforeAll(async () => { }
await nextBuild(appDir, [], {})
appPort = await findPort()
app = await nextStart(appDir, appPort)
})
afterAll(async () => {
await killApp(app)
}) })
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', () => { describe('Page reload on CSS missing', () => {
const appDir = join(fixturesDir, 'transition-reload') const appDir = join(fixturesDir, 'transition-reload')
......
...@@ -7952,12 +7952,13 @@ ...@@ -7952,12 +7952,13 @@
"CSS Support production mode CSS Import from node_modules useLightnincsss(true) should fail the build" "CSS Support production mode CSS Import from node_modules useLightnincsss(true) should fail the build"
], ],
"failed": [ "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(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" "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": [], "flakey": [],
"runtimeError": false "runtimeError": false
}, },
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