diff --git a/.github/workflows/test_e2e_deploy.yml b/.github/workflows/test_e2e_deploy.yml index 8871dacfe0c97..feb37aec4c4b4 100644 --- a/.github/workflows/test_e2e_deploy.yml +++ b/.github/workflows/test_e2e_deploy.yml @@ -51,7 +51,7 @@ jobs: - run: node scripts/run-e2e-test-project-reset.mjs name: Reset test project - - run: docker run --rm -v $(pwd):/work mcr.microsoft.com/playwright:v1.35.1-jammy /bin/bash -c "cd /work && NODE_VERSION=${{ env.NODE_LTS_VERSION }} ./scripts/setup-node.sh && corepack enable > /dev/null && NEXT_JUNIT_TEST_REPORT=true DATADOG_API_KEY=${DATADOG_API_KEY} DD_ENV=ci VERCEL_TEST_TOKEN=${{ secrets.VERCEL_TEST_TOKEN }} VERCEL_TEST_TEAM=vtest314-next-e2e-tests NEXT_TEST_JOB=1 NEXT_TEST_MODE=deploy TEST_TIMINGS_TOKEN=${{ secrets.TEST_TIMINGS_TOKEN }} NEXT_TEST_CONTINUE_ON_ERROR=1 xvfb-run node run-tests.js --type e2e --timings -g ${{ matrix.group }}/2 -c 1 >> /proc/1/fd/1" + - run: docker run --rm -v $(pwd):/work mcr.microsoft.com/playwright:v1.35.1-jammy /bin/bash -c "cd /work && NODE_VERSION=${{ env.NODE_LTS_VERSION }} ./scripts/setup-node.sh && corepack enable > /dev/null && NEXT_JUNIT_TEST_REPORT=true DATADOG_API_KEY=${DATADOG_API_KEY} DD_ENV=ci VERCEL_TEST_TOKEN=${{ secrets.VERCEL_TEST_TOKEN }} VERCEL_TEST_TEAM=vtest314-next-e2e-tests NEXT_TEST_JOB=1 NEXT_TEST_MODE=deploy TEST_TIMINGS_TOKEN=${{ secrets.TEST_TIMINGS_TOKEN }} xvfb-run node run-tests.js --type e2e --timings -g ${{ matrix.group }}/2 -c 1 >> /proc/1/fd/1" name: Run test/e2e (deploy) - name: Upload test report diff --git a/test/lib/e2e-utils.ts b/test/lib/e2e-utils.ts index 7da67a75bd6c1..d87e94f79c77a 100644 --- a/test/lib/e2e-utils.ts +++ b/test/lib/e2e-utils.ts @@ -213,16 +213,12 @@ export async function createNext( } catch (err) { require('console').error('Failed to create next instance', err) try { - nextInstance.destroy() + await nextInstance?.destroy() } catch (_) {} - if (process.env.NEXT_TEST_CONTINUE_ON_ERROR) { - // Other test should continue to create new instance if NEXT_TEST_CONTINUE_ON_ERROR explicitly specified. - nextInstance = undefined - throw err - } else { - process.exit(1) - } + nextInstance = undefined + // Throw instead of process exit to ensure that Jest reports the tests as failed. + throw err } finally { flushAllTraces() }