Unverified Commit 18f237c5 authored by Tim Neutkens's avatar Tim Neutkens Committed by GitHub

Turbopack build: Skip webpack config tests (#69729)

Found a few more tests that are related to custom webpack configuration.

<!-- 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 2595a276
...@@ -6,16 +6,18 @@ import { nextBuild } from 'next-test-utils' ...@@ -6,16 +6,18 @@ import { nextBuild } from 'next-test-utils'
const appDir = join(__dirname, '..') const appDir = join(__dirname, '..')
describe('Promise in next config', () => { ;(process.env.TURBOPACK ? describe.skip : describe)(
;(process.env.TURBOPACK_DEV ? describe.skip : describe)( 'Promise in next config',
'production mode', () => {
() => { ;(process.env.TURBOPACK_DEV ? describe.skip : describe)(
afterEach(() => fs.remove(join(appDir, 'next.config.js'))) 'production mode',
() => {
afterEach(() => fs.remove(join(appDir, 'next.config.js')))
it('should warn when a promise is returned on webpack', async () => { it('should warn when a promise is returned on webpack', async () => {
fs.writeFile( fs.writeFile(
join(appDir, 'next.config.js'), join(appDir, 'next.config.js'),
` `
module.exports = (phase, { isServer }) => { module.exports = (phase, { isServer }) => {
return { return {
webpack: async (config) => { webpack: async (config) => {
...@@ -24,16 +26,17 @@ describe('Promise in next config', () => { ...@@ -24,16 +26,17 @@ describe('Promise in next config', () => {
} }
} }
` `
) )
const { stderr, stdout } = await nextBuild(appDir, undefined, { const { stderr, stdout } = await nextBuild(appDir, undefined, {
stderr: true, stderr: true,
stdout: true, stdout: true,
})
expect(stderr + stdout).toMatch(
/> Promise returned in next config\. https:\/\//
)
}) })
expect(stderr + stdout).toMatch( }
/> Promise returned in next config\. https:\/\// )
) }
}) )
}
)
})
...@@ -6,77 +6,82 @@ import { nextBuild } from 'next-test-utils' ...@@ -6,77 +6,82 @@ import { nextBuild } from 'next-test-utils'
const appDir = join(__dirname, '../app') const appDir = join(__dirname, '../app')
describe('build trace with extra entries', () => { ;(process.env.TURBOPACK ? describe.skip : describe)(
;(process.env.TURBOPACK_DEV ? describe.skip : describe)( 'build trace with extra entries',
'production mode', () => {
() => { ;(process.env.TURBOPACK_DEV ? describe.skip : describe)(
it('should build and trace correctly', async () => { 'production mode',
const result = await nextBuild(appDir, undefined, { () => {
cwd: appDir, it('should build and trace correctly', async () => {
stderr: true, const result = await nextBuild(appDir, undefined, {
stdout: true, cwd: appDir,
}) stderr: true,
console.log(result) stdout: true,
expect(result.code).toBe(0) })
console.log(result)
const appTrace = await fs.readJSON( expect(result.code).toBe(0)
join(appDir, '.next/server/pages/_app.js.nft.json')
)
const indexTrace = await fs.readJSON(
join(appDir, '.next/server/pages/index.js.nft.json')
)
const anotherTrace = await fs.readJSON(
join(appDir, '.next/server/pages/another.js.nft.json')
)
const imageTrace = await fs.readJSON(
join(appDir, '.next/server/pages/image-import.js.nft.json')
)
const tracedFiles = [
...appTrace.files,
...indexTrace.files,
...anotherTrace.files,
...imageTrace.files,
]
expect(tracedFiles.some((file) => file.endsWith('hello.json'))).toBe( const appTrace = await fs.readJSON(
true join(appDir, '.next/server/pages/_app.js.nft.json')
) )
expect( const indexTrace = await fs.readJSON(
tracedFiles.some((file) => file.includes('some-cms/index.js')) join(appDir, '.next/server/pages/index.js.nft.json')
).toBe(true)
expect(
tracedFiles.some((file) => file === '../../../include-me/hello.txt')
).toBe(true)
expect(
tracedFiles.some((file) => file === '../../../include-me/second.txt')
).toBe(true)
expect(
indexTrace.files.some((file) => file.includes('exclude-me'))
).toBe(false)
expect(
tracedFiles.some((file) =>
file.includes('nested-structure/constants/package.json')
) )
).toBe(true) const anotherTrace = await fs.readJSON(
expect( join(appDir, '.next/server/pages/another.js.nft.json')
tracedFiles.some((file) =>
file.includes('nested-structure/package.json')
) )
).toBe(true) const imageTrace = await fs.readJSON(
expect( join(appDir, '.next/server/pages/image-import.js.nft.json')
tracedFiles.some((file) =>
file.includes('nested-structure/lib/constants.js')
) )
).toBe(true)
expect( const tracedFiles = [
tracedFiles.some((file) => file.includes('public/another.jpg')) ...appTrace.files,
).toBe(true) ...indexTrace.files,
expect( ...anotherTrace.files,
tracedFiles.some((file) => file.includes('public/test.jpg')) ...imageTrace.files,
).toBe(false) ]
})
} expect(tracedFiles.some((file) => file.endsWith('hello.json'))).toBe(
) true
}) )
expect(
tracedFiles.some((file) => file.includes('some-cms/index.js'))
).toBe(true)
expect(
tracedFiles.some((file) => file === '../../../include-me/hello.txt')
).toBe(true)
expect(
tracedFiles.some(
(file) => file === '../../../include-me/second.txt'
)
).toBe(true)
expect(
indexTrace.files.some((file) => file.includes('exclude-me'))
).toBe(false)
expect(
tracedFiles.some((file) =>
file.includes('nested-structure/constants/package.json')
)
).toBe(true)
expect(
tracedFiles.some((file) =>
file.includes('nested-structure/package.json')
)
).toBe(true)
expect(
tracedFiles.some((file) =>
file.includes('nested-structure/lib/constants.js')
)
).toBe(true)
expect(
tracedFiles.some((file) => file.includes('public/another.jpg'))
).toBe(true)
expect(
tracedFiles.some((file) => file.includes('public/test.jpg'))
).toBe(false)
})
}
)
}
)
...@@ -7555,10 +7555,10 @@ ...@@ -7555,10 +7555,10 @@
}, },
"test/integration/config-promise-error/test/index.test.js": { "test/integration/config-promise-error/test/index.test.js": {
"passed": [], "passed": [],
"failed": [ "failed": [],
"pending": [
"Promise in next config production mode should warn when a promise is returned on webpack" "Promise in next config production mode should warn when a promise is returned on webpack"
], ],
"pending": [],
"flakey": [], "flakey": [],
"runtimeError": false "runtimeError": false
}, },
...@@ -15300,10 +15300,10 @@ ...@@ -15300,10 +15300,10 @@
}, },
"test/integration/turbotrace-with-webpack-worker/test/index.test.js": { "test/integration/turbotrace-with-webpack-worker/test/index.test.js": {
"passed": [], "passed": [],
"failed": [ "failed": [],
"pending": [
"build trace with extra entries production mode should build and trace correctly" "build trace with extra entries production mode should build and trace correctly"
], ],
"pending": [],
"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