From 141ed09f69afe3bf894a1e3d23bbf9dac595b42e Mon Sep 17 00:00:00 2001 From: Rob Hogan Date: Sat, 21 Nov 2026 10:46:04 +0000 Subject: [PATCH] CI: Test under pnpm's isolated node_modules #2116, #2257 etc fixed some missing dependencies, now we close the loop by ensuring we can't regress. This adds a `test-pnpm` job to `build-test-and-deploy`. It generates `pnpm-lock.yaml` from `yarn.lock` with `pnpm import`, installs, and runs Flow, `typecheck-ts`, lint and Jest (with the same retries as the Yarn test job). It doesn't need to run on multiple platforms / versions so it's just Ubuntu and Node LTS. Changelog: Internal Test plan: `actionlint` passes. Ran the job's steps locally against a fresh copy of this PR, with pnpm 12.21.0 (on Node 22.13 rather than 24) - all pass, including Jest (175 suites, 3475 tests). CI on this PR runs the new job. --- .github/workflows/build-test-and-deploy.yml | 33 +++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/.github/workflows/build-test-and-deploy.yml b/.github/workflows/build-test-and-deploy.yml index 626c50c47f..3a89ca2d7a 100644 --- a/.github/workflows/build-test-and-deploy.yml +++ b/.github/workflows/build-test-and-deploy.yml @@ -65,6 +65,39 @@ jobs: node-version: ${{ matrix.node-version }} runs-on: ${{ matrix.runs-on }} + # Yarn hoists everything into the root node_modules, which can hide + # undeclared dependencies. pnpm's isolated node_modules catches them. + test-pnpm: + runs-on: ubuntu-latest + name: "Tests [pnpm, isolated node_modules]" + steps: + - uses: actions/checkout@v7 + - uses: pnpm/action-setup@v6 + with: + version: 12 + - uses: actions/setup-node@v6 + with: + node-version: 'lts/*' + # yarn.lock is the source of truth - generate pnpm-lock.yaml from it + - run: pnpm import + - run: pnpm install --frozen-lockfile + - run: pnpm run typecheck + - run: pnpm run typecheck-ts + - run: pnpm run lint + - name: Run Jest Tests + run: | + max_attempts=3 + attempt=1 + until pnpm exec jest --ci --maxWorkers 4; do + if [ $attempt -ge $max_attempts ]; then + echo "Tests failed after $max_attempts attempts" + exit 1 + fi + echo "Attempt $attempt failed, retrying..." + attempt=$((attempt + 1)) + sleep 5 + done + deploy: # runs only on tag pushes if: ${{ github.ref_type == 'tag' }}