From 91c29e8942879ed8047e2687609ff2b56b2e488b Mon Sep 17 00:00:00 2001 From: Gerald Monaco Date: Tue, 13 Apr 2021 10:16:45 -0700 Subject: [PATCH] Add react@experimental testing (#23359) --- .github/workflows/test_react_experimental.yml | 55 +++++++++++++++++++ .github/workflows/test_react_next.yml | 1 + .../next/next-server/server/config-shared.ts | 2 +- .../build-output/test/index.test.js | 4 ++ .../fallback-modules/test/index.test.js | 4 ++ .../integration/size-limit/test/index.test.js | 4 ++ 6 files changed, 69 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/test_react_experimental.yml diff --git a/.github/workflows/test_react_experimental.yml b/.github/workflows/test_react_experimental.yml new file mode 100644 index 00000000000000..892a7dfab9985e --- /dev/null +++ b/.github/workflows/test_react_experimental.yml @@ -0,0 +1,55 @@ +on: + schedule: + # * is a special character in YAML so you have to quote this string + - cron: '0 0,12 * * *' + +name: Test react@experimental + +jobs: + # build: + # runs-on: ubuntu-latest + # steps: + # - uses: actions/checkout@v2 + + # - run: yarn install --frozen-lockfile --check-files + # env: + # NEXT_TELEMETRY_DISABLED: 1 + + # - run: yarn upgrade react@next react-dom@next -W --dev + + # - uses: actions/cache@v2 + # id: cache-build + # with: + # path: ./* + # key: ${{ github.sha }} + + testAll: + name: Test All + runs-on: ubuntu-latest + # needs: build + env: + NEXT_TELEMETRY_DISABLED: 1 + NEXT_PRIVATE_REACT_MODE: concurrent + HEADLESS: true + NEXT_PRIVATE_SKIP_SIZE_TESTS: true + strategy: + fail-fast: false + matrix: + group: [1, 2, 3, 4, 5, 6] + steps: + # - uses: actions/cache@v2 + # id: restore-build + # with: + # path: ./* + # key: ${{ github.sha }} + + - uses: actions/checkout@v2 + + - run: yarn install --frozen-lockfile --check-files + + - run: yarn upgrade react@experimental react-dom@experimental -W --dev + + # TODO: remove after we fix watchpack watching too much + - run: echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p + + - run: node run-tests.js --timings -g ${{ matrix.group }}/6 -c 3 diff --git a/.github/workflows/test_react_next.yml b/.github/workflows/test_react_next.yml index 9eb76fe8ee4349..0c4c7db08632bc 100644 --- a/.github/workflows/test_react_next.yml +++ b/.github/workflows/test_react_next.yml @@ -30,6 +30,7 @@ jobs: env: NEXT_TELEMETRY_DISABLED: 1 HEADLESS: true + NEXT_PRIVATE_SKIP_SIZE_TESTS: true strategy: fail-fast: false matrix: diff --git a/packages/next/next-server/server/config-shared.ts b/packages/next/next-server/server/config-shared.ts index f508110d429487..1e7d88065294b4 100644 --- a/packages/next/next-server/server/config-shared.ts +++ b/packages/next/next-server/server/config-shared.ts @@ -104,7 +104,7 @@ export const defaultConfig: NextConfig = { plugins: false, profiling: false, sprFlushToDisk: true, - reactMode: 'legacy', + reactMode: (process.env.NEXT_PRIVATE_REACT_MODE as any) || 'legacy', workerThreads: false, pageEnv: false, optimizeImages: false, diff --git a/test/integration/build-output/test/index.test.js b/test/integration/build-output/test/index.test.js index 016d3205ddf186..eb680f8b1010bc 100644 --- a/test/integration/build-output/test/index.test.js +++ b/test/integration/build-output/test/index.test.js @@ -40,6 +40,10 @@ describe('Build Output', () => { it('should not deviate from snapshot', async () => { console.log(stdout) + if (process.env.NEXT_PRIVATE_SKIP_SIZE_TESTS) { + return + } + const parsePageSize = (page) => stdout.match( new RegExp(` ${page} .*?((?:\\d|\\.){1,} (?:\\w{1,})) `) diff --git a/test/integration/fallback-modules/test/index.test.js b/test/integration/fallback-modules/test/index.test.js index d50ab14dd91ecf..63d175fbbaaa65 100644 --- a/test/integration/fallback-modules/test/index.test.js +++ b/test/integration/fallback-modules/test/index.test.js @@ -19,6 +19,10 @@ describe('Build Output', () => { }) it('should not include crypto', async () => { + if (process.env.NEXT_PRIVATE_SKIP_SIZE_TESTS) { + return + } + ;({ stdout } = await nextBuild(appDir, [], { stdout: true, })) diff --git a/test/integration/size-limit/test/index.test.js b/test/integration/size-limit/test/index.test.js index 6734e002d3e863..1b9ada4200ebb6 100644 --- a/test/integration/size-limit/test/index.test.js +++ b/test/integration/size-limit/test/index.test.js @@ -66,6 +66,10 @@ describe('Production response size', () => { }) it('should not increase the overall response size of default build', async () => { + if (process.env.NEXT_PRIVATE_SKIP_SIZE_TESTS) { + return + } + const responseSizes = [ baseResponseSize, ...(await getResponseSizes(scriptsUrls)),