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

Skip @next/font tests in Turbopack as next/font is supported (#60982)

## What?

Skip the `@next/font` legacy tests in Turbopack. `next/font` is
supported with Turbopack enabled.

<!-- 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 #

-->


Closes NEXT-2183
parent f5dab7ce
...@@ -24,7 +24,13 @@ const getAttrs = (elems: Cheerio) => ...@@ -24,7 +24,13 @@ const getAttrs = (elems: Cheerio) =>
.sort((a, b) => (a.href < b.href ? -1 : 1)) .sort((a, b) => (a.href < b.href ? -1 : 1))
describe('app dir - next/font', () => { describe('app dir - next/font', () => {
describe.each([['app'], ['app-old']])('%s', (fixture: string) => { for (const fixture of ['app', 'app-old']) {
describe(fixture, () => {
// Turbopack only support `next/font` as `@next/font` is going to be removed in the next major version.
if (process.env.TURBOPACK && fixture === 'app-old') {
return
}
createNextDescribe( createNextDescribe(
'app dir - next-font', 'app dir - next-font',
{ {
...@@ -404,9 +410,9 @@ describe('app dir - next/font', () => { ...@@ -404,9 +410,9 @@ describe('app dir - next/font', () => {
'link[as="font"]' 'link[as="font"]'
) )
expect(preloadBeforeNavigation.length).toBe(1) expect(preloadBeforeNavigation.length).toBe(1)
expect(await preloadBeforeNavigation[0].getAttribute('href')).toBe( expect(
'/_next/static/media/c287665b44f047d4-s.p.woff2' await preloadBeforeNavigation[0].getAttribute('href')
) ).toBe('/_next/static/media/c287665b44f047d4-s.p.woff2')
// Navigate to a page that also imports that font // Navigate to a page that also imports that font
await browser.elementByCss('a').click() await browser.elementByCss('a').click()
...@@ -432,7 +438,10 @@ describe('app dir - next/font', () => { ...@@ -432,7 +438,10 @@ describe('app dir - next/font', () => {
// Break file // Break file
await next.patchFile( await next.patchFile(
'fonts/index.js', 'fonts/index.js',
font1Content.replace('./font1.woff2', './does-not-exist.woff2') font1Content.replace(
'./font1.woff2',
'./does-not-exist.woff2'
)
) )
expect(await hasRedbox(browser)).toBeTrue() expect(await hasRedbox(browser)).toBeTrue()
expect(await getRedboxSource(browser)).toInclude( expect(await getRedboxSource(browser)).toInclude(
...@@ -448,4 +457,5 @@ describe('app dir - next/font', () => { ...@@ -448,4 +457,5 @@ describe('app dir - next/font', () => {
} }
) )
}) })
}
}) })
...@@ -17,7 +17,12 @@ function getClassNameRegex(className: string): RegExp { ...@@ -17,7 +17,12 @@ function getClassNameRegex(className: string): RegExp {
} }
describe('next/font', () => { describe('next/font', () => {
describe.each([['app'], ['app-old']])('%s', (fixture: string) => { for (const fixture of ['app', 'app-old']) {
describe(fixture, () => {
// Turbopack only support `next/font` as `@next/font` is going to be removed in the next major version.
if (process.env.TURBOPACK && fixture === 'app-old') {
return
}
let next: NextInstance let next: NextInstance
if ((global as any).isNextDeploy) { if ((global as any).isNextDeploy) {
...@@ -636,4 +641,5 @@ describe('next/font', () => { ...@@ -636,4 +641,5 @@ describe('next/font', () => {
}) })
}) })
}) })
}
}) })
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