Skip to content

Commit ad40070

Browse files
committed
ci: pass -u with -t filter so Jest tolerates obsolete snapshots
In non-TTY mode Jest treats snapshots from `-t`-skipped tests as obsolete and exits 1, even when every test that did run passed. Pass `-u` so those snapshots are removed (in-place on the runner; never committed), which lets the filtered Node 10-16 runs complete cleanly. Strict snapshot validation is preserved on the unfiltered Node 18+ rows.
1 parent f0ea2f3 commit ad40070

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

.github/workflows/nodejs.yml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,14 +142,20 @@ jobs:
142142
# `swcMinify`/`swcMinifyHtml`/`swcMinifyCss` need @swc/* binaries that
143143
# aren't available on Node 10/12; `htmlMinifierTerser` requires Node
144144
# 14.13+; `esbuildMinify`/`esbuildMinifyCss` require Node 18+.
145+
#
146+
# `-u` is passed alongside the filter so Jest doesn't fail the CI run
147+
# over the snapshots whose owning tests are skipped by `-t` (Jest
148+
# treats them as obsolete when stdin isn't a TTY). The change is local
149+
# to the runner and never committed, so strict snapshot validation
150+
# still happens on the Node 18+ rows that run the full suite.
145151
shell: bash
146152
run: |
147153
case "${{ matrix.node-version }}" in
148154
10.x|12.x)
149-
npm run test:coverage -- --ci -t '^(?!.*(swcMinify|esbuildMinify|htmlMinifierTerser)).*$'
155+
npm run test:coverage -- --ci -u -t '^(?!.*(swcMinify|esbuildMinify|htmlMinifierTerser)).*$'
150156
;;
151157
14.x|16.x)
152-
npm run test:coverage -- --ci -t '^(?!.*esbuildMinify).*$'
158+
npm run test:coverage -- --ci -u -t '^(?!.*esbuildMinify).*$'
153159
;;
154160
*)
155161
npm run test:coverage -- --ci

0 commit comments

Comments
 (0)