Skip to content

Commit

Permalink
fix test prod
Browse files Browse the repository at this point in the history
  • Loading branch information
ijjk committed May 15, 2023
1 parent 87fad97 commit ba01edf
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 5 deletions.
12 changes: 9 additions & 3 deletions .github/workflows/build_initial.yml
Expand Up @@ -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:
Expand All @@ -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:
Expand All @@ -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'
10 changes: 8 additions & 2 deletions run-tests.js
Expand Up @@ -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
Expand Down

0 comments on commit ba01edf

Please sign in to comment.