Skip to content

Commit 69b5939

Browse files
committed
CI: Test under pnpm's isolated node_modules
Yarn hoists every dependency into the root `node_modules`, so a package can import something it doesn't declare and nothing notices until a user installs it some other way. #2116 fixed the cases in our root scripts, and this makes sure we don'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's a single Ubuntu / Node 24 job rather than another matrix - it's there to catch undeclared dependencies, not platform differences. pnpm is pinned so that `pnpm import` output doesn't drift under us. 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.
1 parent 0686aea commit 69b5939

1 file changed

Lines changed: 34 additions & 0 deletions

File tree

‎.github/workflows/build-test-and-deploy.yml‎

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,40 @@ jobs:
6565
node-version: ${{ matrix.node-version }}
6666
runs-on: ${{ matrix.runs-on }}
6767

68+
# Yarn hoists everything into the root node_modules, which can hide
69+
# undeclared dependencies. pnpm's isolated node_modules catches them.
70+
test-pnpm:
71+
runs-on: ubuntu-latest
72+
name: "Tests [pnpm, isolated node_modules]"
73+
steps:
74+
- uses: actions/checkout@v7
75+
- uses: pnpm/action-setup@v6
76+
with:
77+
version: 12.21.0
78+
- uses: actions/setup-node@v6
79+
with:
80+
node-version: '24.x'
81+
check-latest: true
82+
# yarn.lock is the source of truth - generate pnpm-lock.yaml from it
83+
- run: pnpm import
84+
- run: pnpm install --frozen-lockfile
85+
- run: pnpm run typecheck
86+
- run: pnpm run typecheck-ts
87+
- run: pnpm run lint
88+
- name: Run Jest Tests
89+
run: |
90+
max_attempts=3
91+
attempt=1
92+
until pnpm exec jest --ci --maxWorkers 4; do
93+
if [ $attempt -ge $max_attempts ]; then
94+
echo "Tests failed after $max_attempts attempts"
95+
exit 1
96+
fi
97+
echo "Attempt $attempt failed, retrying..."
98+
attempt=$((attempt + 1))
99+
sleep 5
100+
done
101+
68102
deploy:
69103
# runs only on tag pushes
70104
if: ${{ github.ref_type == 'tag' }}

0 commit comments

Comments
 (0)