Skip to content

Commit

Permalink
Skip production tests for Turbopack (#56045)
Browse files Browse the repository at this point in the history
As Turbopack is only focusing on dev currently. 

<!-- 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 committed Sep 26, 2023
1 parent 379f2d8 commit a961ec0
Show file tree
Hide file tree
Showing 93 changed files with 368 additions and 407 deletions.
26 changes: 13 additions & 13 deletions .github/workflows/build_and_test.yml
Expand Up @@ -152,19 +152,19 @@ jobs:
secrets: inherit

# --type production also runs tests/e2e
test-turbopack-prod:
name: test turbopack prod
needs: ['build-native', 'build-next']
strategy:
fail-fast: false
matrix:
group: [1, 2, 3, 4, 5]
uses: ./.github/workflows/build_reusable.yml
with:
nodeVersion: 16
skipForDocsOnly: 'yes'
afterBuild: RUST_BACKTRACE=0 NEXT_EXTERNAL_TESTS_FILTERS="$(pwd)/test/turbopack-tests-manifest.json" TURBOPACK=1 NEXT_TEST_MODE=start node run-tests.js --timings -g ${{ matrix.group }}/5 -c ${TEST_CONCURRENCY} --type production
secrets: inherit
# test-turbopack-prod:
# name: test turbopack prod
# needs: ['build-native', 'build-next']
# strategy:
# fail-fast: false
# matrix:
# group: [1, 2, 3, 4, 5]
# uses: ./.github/workflows/build_reusable.yml
# with:
# nodeVersion: 16
# skipForDocsOnly: 'yes'
# afterBuild: RUST_BACKTRACE=0 NEXT_EXTERNAL_TESTS_FILTERS="$(pwd)/test/turbopack-tests-manifest.json" TURBOPACK=1 NEXT_TEST_MODE=start node run-tests.js --timings -g ${{ matrix.group }}/5 -c ${TEST_CONCURRENCY} --type production
# secrets: inherit

test-next-swc-wasm:
name: test next-swc wasm
Expand Down
2 changes: 1 addition & 1 deletion test/integration/404-page-app/test/index.test.js
Expand Up @@ -21,7 +21,7 @@ let appPort
let app

describe('404 Page Support with _app', () => {
describe('production mode', () => {
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => {
afterAll(() => killApp(app))

it('should build successfully', async () => {
Expand Down
2 changes: 1 addition & 1 deletion test/integration/amphtml/test/index.test.js
Expand Up @@ -25,7 +25,7 @@ let app
const context = {}

describe('AMP Usage', () => {
describe('production mode', () => {
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => {
let output = ''

beforeAll(async () => {
Expand Down
3 changes: 1 addition & 2 deletions test/integration/app-tree/test/index.test.js
Expand Up @@ -56,8 +56,7 @@ describe('AppTree', () => {
afterAll(() => killApp(app))
runTests()
})

describe('production mode', () => {
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => {
beforeAll(async () => {
await nextBuild(appDir)
appPort = await findPort()
Expand Down
2 changes: 1 addition & 1 deletion test/integration/app-types/app-types.test.js
Expand Up @@ -7,7 +7,7 @@ import { nextBuild } from 'next-test-utils'
const appDir = __dirname

describe('app type checking', () => {
describe('production mode', () => {
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => {
let stderr, errors
beforeAll(async () => {
stderr = (await nextBuild(appDir, [], { stderr: true })).stderr
Expand Down
3 changes: 1 addition & 2 deletions test/integration/async-modules/test/index.test.js
Expand Up @@ -115,8 +115,7 @@ describe('Async modules', () => {

runTests(true)
})

describe('production mode', () => {
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => {
beforeAll(async () => {
await nextBuild(appDir)
appPort = await findPort()
Expand Down
3 changes: 1 addition & 2 deletions test/integration/basepath-root-catch-all/test/index.test.js
Expand Up @@ -37,8 +37,7 @@ describe('dev mode', () => {
afterAll(() => killApp(app))
runTests()
})

describe('production mode', () => {
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => {
beforeAll(async () => {
await nextBuild(appDir)
buildId = await fs.readFile(join(appDir, '.next/BUILD_ID'), 'utf8')
Expand Down
3 changes: 1 addition & 2 deletions test/integration/client-404/test/index.test.js
Expand Up @@ -35,8 +35,7 @@ describe('Client 404', () => {

runTests()
})

describe('production mode', () => {
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => {
beforeAll(async () => {
await nextBuild(appDir)
context.appPort = await findPort()
Expand Down
3 changes: 1 addition & 2 deletions test/integration/client-shallow-routing/test/index.test.js
Expand Up @@ -97,8 +97,7 @@ describe('Client Shallow Routing', () => {

runTests()
})

describe('production mode', () => {
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => {
beforeAll(async () => {
await nextBuild(appDir)
appPort = await findPort()
Expand Down
6 changes: 2 additions & 4 deletions test/integration/css/test/css-modules.test.js
Expand Up @@ -93,8 +93,7 @@ describe('Basic CSS Modules Ordering', () => {

tests()
})

describe('Production Mode', () => {
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => {
beforeAll(async () => {
await remove(join(appDir, '.next'))
})
Expand Down Expand Up @@ -436,8 +435,7 @@ describe('CSS Modules Composes Ordering', () => {

tests(true)
})

describe('Production Mode', () => {
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => {
beforeAll(async () => {
await remove(join(appDir, '.next'))
})
Expand Down
180 changes: 96 additions & 84 deletions test/integration/css/test/css-rendering.test.js
Expand Up @@ -168,21 +168,24 @@ describe('CSS Support', () => {
})
}

describe('Production Mode', () => {
beforeAll(async () => {
await remove(join(appDir, '.next'))
})
beforeAll(async () => {
await nextBuild(appDir, [], {})
appPort = await findPort()
app = await nextStart(appDir, appPort)
})
afterAll(async () => {
await killApp(app)
})

tests()
})
;(process.env.TURBOPACK ? describe.skip : describe)(
'production mode',
() => {
beforeAll(async () => {
await remove(join(appDir, '.next'))
})
beforeAll(async () => {
await nextBuild(appDir, [], {})
appPort = await findPort()
app = await nextStart(appDir, appPort)
})
afterAll(async () => {
await killApp(app)
})

tests()
}
)
})

describe('CSS Cleanup on Render Failure', () => {
Expand Down Expand Up @@ -231,21 +234,24 @@ describe('CSS Support', () => {
})
}

describe('Production Mode', () => {
beforeAll(async () => {
await remove(join(appDir, '.next'))
})
beforeAll(async () => {
await nextBuild(appDir, [], {})
appPort = await findPort()
app = await nextStart(appDir, appPort)
})
afterAll(async () => {
await killApp(app)
})

tests()
})
;(process.env.TURBOPACK ? describe.skip : describe)(
'production mode',
() => {
beforeAll(async () => {
await remove(join(appDir, '.next'))
})
beforeAll(async () => {
await nextBuild(appDir, [], {})
appPort = await findPort()
app = await nextStart(appDir, appPort)
})
afterAll(async () => {
await killApp(app)
})

tests()
}
)
})

describe('Page reload on CSS missing', () => {
Expand Down Expand Up @@ -280,31 +286,34 @@ describe('CSS Support', () => {
})
}

describe('Production Mode', () => {
beforeAll(async () => {
await remove(join(appDir, '.next'))
})
beforeAll(async () => {
await nextBuild(appDir, [], {})
appPort = await findPort()
app = await nextStart(appDir, appPort)

// Remove other page CSS files:
const manifest = await readJSON(
join(appDir, '.next', 'build-manifest.json')
)
const files = manifest['pages']['/other'].filter((e) =>
e.endsWith('.css')
)
if (files.length < 1) throw new Error()
await Promise.all(files.map((f) => remove(join(appDir, '.next', f))))
})
afterAll(async () => {
await killApp(app)
})

tests()
})
;(process.env.TURBOPACK ? describe.skip : describe)(
'production mode',
() => {
beforeAll(async () => {
await remove(join(appDir, '.next'))
})
beforeAll(async () => {
await nextBuild(appDir, [], {})
appPort = await findPort()
app = await nextStart(appDir, appPort)

// Remove other page CSS files:
const manifest = await readJSON(
join(appDir, '.next', 'build-manifest.json')
)
const files = manifest['pages']['/other'].filter((e) =>
e.endsWith('.css')
)
if (files.length < 1) throw new Error()
await Promise.all(files.map((f) => remove(join(appDir, '.next', f))))
})
afterAll(async () => {
await killApp(app)
})

tests()
}
)
})

describe('Page hydrates with CSS and not waiting on dependencies', () => {
Expand Down Expand Up @@ -373,34 +382,37 @@ describe('CSS Support', () => {
})
}

describe('Production Mode', () => {
beforeAll(async () => {
await remove(join(appDir, '.next'))
})
beforeAll(async () => {
await nextBuild(appDir, [], {})
appPort = await findPort()
app = await nextStart(appDir, appPort)

const buildId = (
await readFile(join(appDir, '.next', 'BUILD_ID'), 'utf8')
).trim()
const fileName = join(
appDir,
'.next/static/',
buildId,
'_buildManifest.js'
)
if (!(await pathExists(fileName))) {
throw new Error('Missing build manifest')
}
await remove(fileName)
})
afterAll(async () => {
await killApp(app)
})

tests()
})
;(process.env.TURBOPACK ? describe.skip : describe)(
'production mode',
() => {
beforeAll(async () => {
await remove(join(appDir, '.next'))
})
beforeAll(async () => {
await nextBuild(appDir, [], {})
appPort = await findPort()
app = await nextStart(appDir, appPort)

const buildId = (
await readFile(join(appDir, '.next', 'BUILD_ID'), 'utf8')
).trim()
const fileName = join(
appDir,
'.next/static/',
buildId,
'_buildManifest.js'
)
if (!(await pathExists(fileName))) {
throw new Error('Missing build manifest')
}
await remove(fileName)
})
afterAll(async () => {
await killApp(app)
})

tests()
}
)
})
})
3 changes: 1 addition & 2 deletions test/integration/custom-error/test/index.test.js
Expand Up @@ -79,8 +79,7 @@ describe('Custom _error', () => {
expect(html).toContain('An error 404 occurred on server')
})
})

describe('production mode', () => {
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => {
let buildOutput = ''

beforeAll(async () => {
Expand Down
3 changes: 1 addition & 2 deletions test/integration/custom-page-extension/test/index.test.js
Expand Up @@ -35,8 +35,7 @@ describe('Custom page extension', () => {
afterAll(() => killApp(app))
runTests()
})

describe('production mode', () => {
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => {
beforeAll(async () => {
await nextBuild(appDir)
appPort = await findPort()
Expand Down
3 changes: 1 addition & 2 deletions test/integration/custom-routes-catchall/test/index.test.js
Expand Up @@ -53,8 +53,7 @@ describe('Custom routes', () => {
afterAll(() => killApp(app))
runTests(true)
})

describe('production mode', () => {
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => {
beforeAll(async () => {
await nextBuild(appDir)
appPort = await findPort()
Expand Down
Expand Up @@ -69,8 +69,7 @@ describe('Custom routes i18n with index redirect', () => {
afterAll(() => killApp(app))
runTests(true)
})

describe('production mode', () => {
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => {
beforeAll(async () => {
await nextBuild(appDir)
appPort = await findPort()
Expand Down
3 changes: 1 addition & 2 deletions test/integration/custom-routes-i18n/test/index.test.js
Expand Up @@ -176,8 +176,7 @@ describe('Custom routes i18n', () => {
afterAll(() => killApp(app))
runTests(true)
})

describe('production mode', () => {
;(process.env.TURBOPACK ? describe.skip : describe)('production mode', () => {
beforeAll(async () => {
await nextBuild(appDir)
appPort = await findPort()
Expand Down

0 comments on commit a961ec0

Please sign in to comment.