Unverified Commit 22420f77 authored by Tim Neutkens's avatar Tim Neutkens Committed by GitHub

Turbopack: Update app-dir tests (#76145)

## What?

- Removes an outdated test
- Moved a passing tests
- Made the failing chunk test fail immediately instead of taking 30
seconds to get to the failure

<!-- 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 85e1ee5a
...@@ -65,15 +65,6 @@ describe('app dir - basic', () => { ...@@ -65,15 +65,6 @@ describe('app dir - basic', () => {
} }
if (isNextStart && !process.env.NEXT_EXPERIMENTAL_COMPILE) { if (isNextStart && !process.env.NEXT_EXPERIMENTAL_COMPILE) {
it('should not have loader generated function for edge runtime', async () => {
expect(
await next.readFile('.next/server/app/dashboard/page.js')
).not.toContain('_stringifiedConfig')
expect(await next.readFile('.next/server/middleware.js')).not.toContain(
'_middlewareConfig'
)
})
if (!process.env.NEXT_EXPERIMENTAL_COMPILE) { if (!process.env.NEXT_EXPERIMENTAL_COMPILE) {
it('should have correct size in build output', async () => { it('should have correct size in build output', async () => {
expect(next.cliOutput).toMatch( expect(next.cliOutput).toMatch(
...@@ -172,28 +163,32 @@ describe('app dir - basic', () => { ...@@ -172,28 +163,32 @@ describe('app dir - basic', () => {
}) })
} }
it('should encode chunk path correctly', async () => { // Turbopack has different chunking in dev/production which results in the entrypoint name not being included in the outputs.
await next.fetch('/dynamic-client/first/second') if (!process.env.TURBOPACK) {
const browser = await next.browser('/') it('should encode chunk path correctly', async () => {
const requests = [] await next.fetch('/dynamic-client/first/second')
browser.on('request', (req) => { const browser = await next.browser('/')
requests.push(req.url()) const requests = []
}) browser.on('request', (req) => {
requests.push(req.url())
await browser.eval('window.location.href = "/dynamic-client/first/second"') })
await check(async () => { await browser.eval(
return requests.some( 'window.location.href = "/dynamic-client/first/second"'
(req) =>
req.includes(
encodeURI(isTurbopack ? '[category]_[id]' : '/[category]/[id]')
) && req.includes('.js')
) )
? 'found'
: // When it fails will log out the paths. await browser.waitForElementByCss('#id-page-params')
JSON.stringify(requests)
}, 'found') expect(
}) requests.some(
(req) =>
req.includes(
encodeURI(isTurbopack ? '[category]_[id]' : '/[category]/[id]')
) && req.includes('.js')
)
).toBe(true)
})
}
it.each([ it.each([
{ pathname: '/redirect-1' }, { pathname: '/redirect-1' },
......
...@@ -1236,13 +1236,11 @@ ...@@ -1236,13 +1236,11 @@
"app dir - basic should use text/x-component for flight with edge runtime", "app dir - basic should use text/x-component for flight with edge runtime",
"app dir - basic should work for catch-all edge page", "app dir - basic should work for catch-all edge page",
"app dir - basic template component should render the template that holds state in a client component and reset on navigation", "app dir - basic template component should render the template that holds state in a client component and reset on navigation",
"app dir - basic template component should render the template that is a server component and rerender on navigation" "app dir - basic template component should render the template that is a server component and rerender on navigation",
],
"failed": [
"app dir - basic should encode chunk path correctly",
"app dir - basic should generate build traces correctly", "app dir - basic should generate build traces correctly",
"app dir - basic should not have loader generated function for edge runtime" "app dir - basic should encode chunk path correctly"
], ],
"failed": [],
"pending": [ "pending": [
"app dir - basic known bugs should support React fetch instrumentation client component", "app dir - basic known bugs should support React fetch instrumentation client component",
"app dir - basic known bugs should support React fetch instrumentation client component client-navigation", "app dir - basic known bugs should support React fetch instrumentation client component client-navigation",
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