Unverified Commit 633719e8 authored by Tim Neutkens's avatar Tim Neutkens Committed by GitHub

Skip Babel tests for Turbopack (#56091)

Follow-up to #56089, skips the Babel tests.

<!-- 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 cbe8238e
...@@ -38,12 +38,17 @@ describe.each([ ...@@ -38,12 +38,17 @@ describe.each([
basePath: string, basePath: string,
testCase: 'swc' | 'babel' | 'document.getInitialProps' testCase: 'swc' | 'babel' | 'document.getInitialProps'
) => { ) => {
;(process.env.TURBOPACK && testCase === 'babel' ? describe.skip : describe)(
testCase,
() => {
let next: NextInstance let next: NextInstance
beforeAll(async () => { beforeAll(async () => {
next = await createNext({ next = await createNext({
files: { files: {
components: new FileRef(join(__dirname, 'next-dynamic/components')), components: new FileRef(
join(__dirname, 'next-dynamic/components')
),
pages: new FileRef(join(__dirname, 'next-dynamic/pages')), pages: new FileRef(join(__dirname, 'next-dynamic/pages')),
...(testCase === 'document.getInitialProps' && ...(testCase === 'document.getInitialProps' &&
customDocumentGipFiles), customDocumentGipFiles),
...@@ -68,25 +73,28 @@ describe.each([ ...@@ -68,25 +73,28 @@ describe.each([
it('should render dynamic import components', async () => { it('should render dynamic import components', async () => {
const $ = await get$(basePath + '/dynamic/ssr') const $ = await get$(basePath + '/dynamic/ssr')
// Make sure the client side knows it has to wait for the bundle // Make sure the client side knows it has to wait for the bundle
expect(JSON.parse($('#__NEXT_DATA__').html()).dynamicIds).toContain( expect(
'dynamic/ssr.js -> ../../components/hello1' JSON.parse($('#__NEXT_DATA__').html()).dynamicIds
) ).toContain('dynamic/ssr.js -> ../../components/hello1')
expect($('body').text()).toMatch(/Hello World 1/) expect($('body').text()).toMatch(/Hello World 1/)
}) })
it('should render dynamic import components using a function as first parameter', async () => { it('should render dynamic import components using a function as first parameter', async () => {
const $ = await get$(basePath + '/dynamic/function') const $ = await get$(basePath + '/dynamic/function')
// Make sure the client side knows it has to wait for the bundle // Make sure the client side knows it has to wait for the bundle
expect(JSON.parse($('#__NEXT_DATA__').html()).dynamicIds).toContain( expect(
'dynamic/function.js -> ../../components/hello1' JSON.parse($('#__NEXT_DATA__').html()).dynamicIds
) ).toContain('dynamic/function.js -> ../../components/hello1')
expect($('body').text()).toMatch(/Hello World 1/) expect($('body').text()).toMatch(/Hello World 1/)
}) })
it('should render even there are no physical chunk exists', async () => { it('should render even there are no physical chunk exists', async () => {
let browser let browser
try { try {
browser = await webdriver(next.url, basePath + '/dynamic/no-chunk') browser = await webdriver(
next.url,
basePath + '/dynamic/no-chunk'
)
await check( await check(
() => browser.elementByCss('body').text(), () => browser.elementByCss('body').text(),
/Welcome, normal/ /Welcome, normal/
...@@ -113,9 +121,18 @@ describe.each([ ...@@ -113,9 +121,18 @@ describe.each([
it('should hydrate nested chunks', async () => { it('should hydrate nested chunks', async () => {
let browser let browser
try { try {
browser = await webdriver(next.url, basePath + '/dynamic/nested') browser = await webdriver(
await check(() => browser.elementByCss('body').text(), /Nested 1/) next.url,
await check(() => browser.elementByCss('body').text(), /Nested 2/) basePath + '/dynamic/nested'
)
await check(
() => browser.elementByCss('body').text(),
/Nested 1/
)
await check(
() => browser.elementByCss('body').text(),
/Nested 2/
)
await check( await check(
() => browser.elementByCss('body').text(), () => browser.elementByCss('body').text(),
/Browser hydrated/ /Browser hydrated/
...@@ -167,8 +184,14 @@ describe.each([ ...@@ -167,8 +184,14 @@ describe.each([
it('should render the component on client side', async () => { it('should render the component on client side', async () => {
let browser let browser
try { try {
browser = await webdriver(next.url, basePath + '/dynamic/no-ssr') browser = await webdriver(
await check(() => browser.elementByCss('body').text(), /navigator/) next.url,
basePath + '/dynamic/no-ssr'
)
await check(
() => browser.elementByCss('body').text(),
/navigator/
)
expect(await hasRedbox(browser, false)).toBe(false) expect(await hasRedbox(browser, false)).toBe(false)
} finally { } finally {
if (browser) { if (browser) {
...@@ -188,7 +211,10 @@ describe.each([ ...@@ -188,7 +211,10 @@ describe.each([
it('should render the component on client side', async () => { it('should render the component on client side', async () => {
let browser let browser
try { try {
browser = await webdriver(next.url, basePath + '/dynamic/ssr-true') browser = await webdriver(
next.url,
basePath + '/dynamic/ssr-true'
)
await check( await check(
() => browser.elementByCss('body').text(), () => browser.elementByCss('body').text(),
/Hello World 1/ /Hello World 1/
...@@ -304,4 +330,6 @@ describe.each([ ...@@ -304,4 +330,6 @@ describe.each([
}) })
}) })
} }
)
}
) )
...@@ -2,7 +2,7 @@ import { createNextDescribe } from 'e2e-utils' ...@@ -2,7 +2,7 @@ import { createNextDescribe } from 'e2e-utils'
import { check } from 'next-test-utils' import { check } from 'next-test-utils'
createNextDescribe( createNextDescribe(
'router autoscrolling on navigation', 'router autoscrolling on navigation with css modules',
{ {
files: __dirname, files: __dirname,
}, },
......
...@@ -2,8 +2,7 @@ ...@@ -2,8 +2,7 @@
import { join } from 'path' import { join } from 'path'
import { nextBuild } from 'next-test-utils' import { nextBuild } from 'next-test-utils'
;(process.env.TURBOPACK ? describe.skip : describe)('Babel', () => {
describe('Babel', () => {
it('should allow setting babelrc env', async () => { it('should allow setting babelrc env', async () => {
await nextBuild(join(__dirname, '../fixtures/babel-env')) await nextBuild(join(__dirname, '../fixtures/babel-env'))
}) })
......
...@@ -14,7 +14,7 @@ import rendering from './rendering' ...@@ -14,7 +14,7 @@ import rendering from './rendering'
const context = {} const context = {}
describe('Babel', () => { ;(process.env.TURBOPACK ? describe.skip : describe)('Babel', () => {
beforeAll(async () => { beforeAll(async () => {
context.appPort = await findPort() context.appPort = await findPort()
context.server = await launchApp(join(__dirname, '../'), context.appPort) context.server = await launchApp(join(__dirname, '../'), context.appPort)
......
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