Skip to content

Commit 4c5609b

Browse files
committed
ci: run the test suite against React 19 (#789)
CI type-checks React 19 but has never executed a test against it: the react matrix exists only on the type-check job, and the test job runs the lockfile's React 18. This adds react 18/19 as a test-job dimension, so the suite runs on 19 before any src/ change lands for the React 19 foundation. @testing-library/react moves 14 -> 16, with @testing-library/dom as a new direct dependency. This is forced rather than opportunistic: RTL 14 declares React ^18 only, so the 19 leg cannot run without it. The lockfile shrinks because RTL 14's nested @testing-library/dom collapses into the top-level install; no packages are added. The React 18 legs keep their existing job names, so main's required status checks keep matching and no admin change is needed. Only the 19 legs get a suffix, which also means a React 19 failure does not gate a merge while 19 support is still being built. A guard step after the artifact overlay asserts the installed React matches the matrix leg. Without it the dimension is decorative: the only behavioural difference between the legs is one skipped test, so a 19 leg that silently ran 18 would pass. That one test is skipped on 19 only, tracked in #793: in suspense mode, swapping the observable resumes with the previous observable's value on 19.2.8 while passing on 18.2.0, deterministic across three runs each. Emulator jobs go from two to four, which doubles per-PR exposure to the #776 flake. Refs #789
1 parent e7b18c2 commit 4c5609b

5 files changed

Lines changed: 71 additions & 199 deletions

File tree

‎.github/workflows/test.yaml‎

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,14 @@ jobs:
5252
strategy:
5353
matrix:
5454
node: ["22", "24"]
55+
react: ["18", "19"]
5556
fail-fast: false
56-
name: Test Node.js ${{ matrix.node }} (Ubuntu)
57+
# The React 18 legs keep the original job names on purpose: `main`'s required
58+
# status checks reference them, so renaming would block every PR there until
59+
# an admin updated the contexts. Only the non-18 legs get a suffix, which
60+
# also means a React 19 failure does not gate a merge while 19 support is
61+
# still being built. Add the contexts when we want it to.
62+
name: Test Node.js ${{ matrix.node }}${{ matrix.react != '18' && format(' / React {0}', matrix.react) || '' }} (Ubuntu)
5763
steps:
5864
- name: Checkout
5965
uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
@@ -67,6 +73,14 @@ jobs:
6773
cache: 'npm'
6874
- name: Install deps
6975
run: npm ci
76+
# Only the 19 leg swaps the runtime; the 18 leg runs the lockfile's React
77+
# as-is. --no-save keeps the lockfile out of the diff. Note this differs
78+
# from the type-check job, which installs on both legs and also installs
79+
# the types, so the 18 legs of the two jobs cover different React 18
80+
# patch versions.
81+
- name: Install React ${{ matrix.react }}
82+
if: matrix.react == '19'
83+
run: npm install --no-save react@${{ matrix.react }} react-dom@${{ matrix.react }}
7084
- name: Setup Java
7185
uses: actions/setup-java@c1e323688fd81a25caa38c78aa6df2d33d3e20d9 # v4.8.0
7286
with:
@@ -86,6 +100,23 @@ jobs:
86100
run: |
87101
chmod +x reactfire-${{ github.run_id }}/unpack.sh
88102
./reactfire-${{ github.run_id }}/unpack.sh
103+
# Without this the matrix is decorative: the only behavioural difference
104+
# between the legs is one skipped test, so a 19 leg silently running 18
105+
# would pass. Runs after the artifact overlay so it covers everything
106+
# that could disturb the install.
107+
- name: Confirm React ${{ matrix.react }} is what will run
108+
env:
109+
WANT_REACT: ${{ matrix.react }}
110+
run: |
111+
node -e '
112+
const want = process.env.WANT_REACT;
113+
const got = require("react/package.json").version;
114+
if (!got.startsWith(want + ".")) {
115+
console.error(`expected React ${want}, got ${got}`);
116+
process.exit(1);
117+
}
118+
console.log(`React ${got} confirmed for matrix leg ${want}`);
119+
'
89120
- name: Run tests
90121
run: npm run test
91122
type-check:

‎package-lock.json‎

Lines changed: 28 additions & 195 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)