From ba01edfd2369f40b812be306faa709fdfc7ec7da Mon Sep 17 00:00:00 2001 From: JJ Kasper Date: Sun, 14 May 2023 20:23:38 -0700 Subject: [PATCH] fix test prod --- .github/workflows/build_initial.yml | 12 +++++++++--- run-tests.js | 10 ++++++++-- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build_initial.yml b/.github/workflows/build_initial.yml index 6dda002d6fa8..c5253c54845c 100644 --- a/.github/workflows/build_initial.yml +++ b/.github/workflows/build_initial.yml @@ -34,7 +34,7 @@ jobs: uses: vercel/next.js/.github/workflows/build_reusable.yml@ijjk/update-ci-workflow with: - afterBuild: NEXT_TEST_MODE=dev node run-tests.js --timings -g ${{ matrix.group }}/5 -c ${TEST_CONCURRENCY} --test-pattern '(development|e2e|unit)/.*\.test\.(js|jsx|ts|tsx)$' + afterBuild: NEXT_TEST_MODE=dev node run-tests.js --timings -g ${{ matrix.group }}/3 -c ${TEST_CONCURRENCY} --test-pattern '^(development|e2e|unit)/.*\.test\.(js|jsx|ts|tsx)$' secrets: inherit testProd: @@ -46,7 +46,7 @@ jobs: uses: vercel/next.js/.github/workflows/build_reusable.yml@ijjk/update-ci-workflow with: - afterBuild: NEXT_TEST_MODE=dev node run-tests.js --timings -g ${{ matrix.group }}/5 -c ${TEST_CONCURRENCY} --test-pattern '(production|e2e)/.*\.test\.(js|jsx|ts|tsx)$' + afterBuild: NEXT_TEST_MODE=start node run-tests.js --timings -g ${{ matrix.group }}/3 -c ${TEST_CONCURRENCY} --test-pattern '^(production|e2e)/.*\.test\.(js|jsx|ts|tsx)$' secrets: inherit testIntegration: @@ -58,5 +58,11 @@ jobs: uses: vercel/next.js/.github/workflows/build_reusable.yml@ijjk/update-ci-workflow with: - afterBuild: NEXT_TEST_MODE=dev node run-tests.js --timings -g ${{ matrix.group }}/5 -c ${TEST_CONCURRENCY} --test-pattern '(integration)/.*\.test\.(js|jsx|ts|tsx)$' + afterBuild: node run-tests.js --timings -g ${{ matrix.group }}/5 -c ${TEST_CONCURRENCY} --test-pattern '^(integration)/.*\.test\.(js|jsx|ts|tsx)$' secrets: inherit + + testsPass: + name: thank you, next + needs: ['build-initial', 'testIntegration'] + steps: + - run: echo 'success' diff --git a/run-tests.js b/run-tests.js index c2a4b89a9e38..9688f4fb3cd2 100644 --- a/run-tests.js +++ b/run-tests.js @@ -150,14 +150,20 @@ async function main() { let prevTimings if (tests.length === 0) { + let testPatternRegex + + if (testPattern) { + testPatternRegex = new RegExp(testPattern) + } + tests = ( await glob('**/*.test.{js,ts,tsx}', { nodir: true, cwd: path.join(__dirname, 'test'), }) ).filter((test) => { - if (testPattern) { - return new RegExp(testPattern).test(test) + if (testPatternRegex) { + return testPatternRegex.test(test) } if (filterTestsBy) { // only include the specified type