Skip to content

Commit

Permalink
Turbopack build: Fix transpile-packages tests (#67705)
Browse files Browse the repository at this point in the history
Currently this test fails because one route fails to compile during
build, but this route actually doesn't have an associated test. I've
added a valid test for that route and skipped it for now, will file an
issue that we still have to fix it. The 6 tests that were failing on the
build failing now pass.

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

-->
  • Loading branch information
timneutkens authored Jul 13, 2024
1 parent 32819d8 commit 7d33640
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 14 deletions.
18 changes: 7 additions & 11 deletions test/e2e/transpile-packages/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import path from 'path'
import { createNext, FileRef } from 'e2e-utils'
import { NextInstance } from 'e2e-utils'
import webdriver from 'next-webdriver'
import { shouldRunTurboDevTest } from '../../lib/next-test-utils'

describe('transpile packages', () => {
let next: NextInstance
Expand All @@ -18,16 +17,6 @@ describe('transpile packages', () => {
dependencies: {
sass: 'latest',
},
packageJson: {
scripts: {
build: 'next build',
dev: `next ${shouldRunTurboDevTest() ? 'dev --turbo' : 'dev'}`,
start: 'next start',
},
},
installCommand: 'pnpm i',
startCommand: (global as any).isNextDev ? 'pnpm dev' : 'pnpm start',
buildCommand: 'pnpm build',
})
})
afterAll(() => next.destroy())
Expand All @@ -38,6 +27,13 @@ describe('transpile packages', () => {
return
}

// TODO: This test is failing in Turbopack
it.skip('should handle optional peer dependencies', async () => {
const browser = await webdriver(next.url, '/peer-deps')

expect(await browser.elementByCss('h1').text()).toBe('world')
})

describe('css', () => {
it('should handle global css imports inside transpiled modules', async () => {
const browser = await webdriver(next.url, '/global-css')
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { hello } from 'package-with-optional-deps'

export default function Page() {
return hello()
return <h1>{hello()}</h1>
}
4 changes: 2 additions & 2 deletions test/turbopack-build-tests-manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -6093,15 +6093,15 @@
"runtimeError": false
},
"test/e2e/transpile-packages/index.test.ts": {
"passed": [],
"failed": [
"passed": [
"transpile packages css should handle css modules imports inside transpiled modules",
"transpile packages css should handle global css imports inside transpiled modules",
"transpile packages css should handle global scss imports inside transpiled modules",
"transpile packages css should handle scss modules imports inside transpiled modules",
"transpile packages optional deps should hide dynammic module dependency errors from node_modules",
"transpile packages optional deps should not throw an error when optional deps are not installed"
],
"failed": [],
"pending": [],
"flakey": [],
"runtimeError": true
Expand Down

0 comments on commit 7d33640

Please sign in to comment.