Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci(test): enable turbopack test #49466

Merged
merged 1 commit into from
May 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 4 additions & 8 deletions .github/workflows/build_test_deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -822,16 +822,12 @@ jobs:
TEST_TIMINGS_TOKEN: ${{ secrets.TEST_TIMINGS_TOKEN }}
# Enabling backtrace will makes snapshot tests fail
RUST_BACKTRACE: 0
# Path to the custom next-swc bindings located in **docker container** image.
# Path to the custom next-swc bindings.
NEXT_BINDINGS_BIN: /work/packages/next-swc/native/next-swc.linux-x64-gnu.node
# Glob pattern to run specific tests with --turbo.
NEXT_DEV_TEST_GLOB: '*'
# List of test files to run with turbopack as blocking CI check.
# [TODO]: as list grows we should consider different way to manage this.
TEST_FILES_LIST: |
test/development/acceptance-app/dynamic-error.test.ts \
test/development/acceptance-app/unsupported-app-features.test.ts \
test/development/acceptance-app/ReactRefresh.test.ts
NEXT_EXTERNAL_TESTS_FILTERS: /work/packages/next-swc/crates/next-dev-tests/tests-manifest.json

strategy:
fail-fast: false
steps:
Expand All @@ -855,7 +851,7 @@ jobs:
name: next-swc-test-binary
path: packages/next-swc/native

- run: docker run --rm -v $(pwd):/work mcr.microsoft.com/playwright:v1.28.1-jammy /bin/bash -c "cd /work && NODE_VERSION=${{ env.NODE_LTS_VERSION }} ./scripts/setup-node.sh && node -v && npm i -g pnpm@${PNPM_VERSION} > /dev/null && __INTERNAL_NEXT_DEV_TEST_TURBO_DEV=TRUE __INTERNAL_CUSTOM_TURBOPACK_BINDINGS=${NEXT_BINDINGS_BIN} __INTERNAL_NEXT_DEV_TEST_TURBO_GLOB_MATCH=${NEXT_DEV_TEST_GLOB} NEXT_E2E_TEST_TIMEOUT=240000 NEXT_TEST_JOB=1 NEXT_TEST_MODE=dev TEST_TIMINGS_TOKEN=${{ secrets.TEST_TIMINGS_TOKEN }} xvfb-run node run-tests.js --type development --timings -c 1 $TEST_FILES_LIST >> /proc/1/fd/1"
- run: docker run --rm -v $(pwd):/work mcr.microsoft.com/playwright:v1.28.1-jammy /bin/bash -c "cd /work && NODE_VERSION=${{ env.NODE_LTS_VERSION }} ./scripts/setup-node.sh && node -v && npm i -g pnpm@${PNPM_VERSION} > /dev/null && NEXT_EXTERNAL_TESTS_FILTERS=${NEXT_EXTERNAL_TESTS_FILTERS} __INTERNAL_NEXT_DEV_TEST_TURBO_DEV=TRUE __INTERNAL_CUSTOM_TURBOPACK_BINDINGS=${NEXT_BINDINGS_BIN} __INTERNAL_NEXT_DEV_TEST_TURBO_GLOB_MATCH=${NEXT_DEV_TEST_GLOB} NEXT_E2E_TEST_TIMEOUT=240000 NEXT_TEST_JOB=1 NEXT_TEST_MODE=dev TEST_TIMINGS_TOKEN=${{ secrets.TEST_TIMINGS_TOKEN }} xvfb-run node run-tests.js --type development --timings -c 1 >> /proc/1/fd/1"
name: Run test/development
if: ${{needs.build.outputs.docsChange == 'nope'}}

Expand Down
6 changes: 6 additions & 0 deletions packages/next-swc/crates/next-dev-tests/tests-manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[
"test/development/acceptance-app/dynamic-error.test.ts",
"test/development/basic/legacy-decorators.test.ts",
"test/integration/plugin-mdx-rs/test/index.test.js",
"test/e2e/app-dir/underscore-ignore-app-paths/underscore-ignore-app-paths.test.ts"
]
9 changes: 8 additions & 1 deletion run-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ const { createNextInstall } = require('./test/lib/create-next-install')
const glob = promisify(_glob)
const exec = promisify(execOrig)

// Try to read an external array-based json to filter tests to be executed.
// If process.argv contains a test to be executed, this'll append it to the list.
const externalTestsFilterLists = process.env.NEXT_EXTERNAL_TESTS_FILTERS
? require(process.env.NEXT_EXTERNAL_TESTS_FILTERS)
: []
const timings = []
const DEFAULT_NUM_RETRIES = os.platform() === 'win32' ? 2 : 1
const DEFAULT_CONCURRENCY = 2
Expand Down Expand Up @@ -138,7 +143,9 @@ async function main() {

console.log('Running tests with concurrency:', concurrency)

let tests = process.argv.filter((arg) => arg.match(/\.test\.(js|ts|tsx)/))
let tests = process.argv
.filter((arg) => arg.match(/\.test\.(js|ts|tsx)/))
.concat(externalTestsFilterLists)
let prevTimings

if (tests.length === 0) {
Expand Down