Fix intermittent Jest smoke test failures#1395
Merged
Merged
Conversation
The Jest CommonJS smoke test pulls jest@30.4.2 via `npm exec --yes`,
which installs jest and its full transitive tree (including babel and
browserslist) into the lockfile-less npx cache on every run. Jest's
default transform loads babel-jest -> @babel/core -> browserslist, and
an intermittently corrupted browserslist in that cache fails the run
with 'SyntaxError: Invalid regular expression' before any test executes.
The smoke test is plain CommonJS that Node runs natively, so no
transformation is needed. Pass `--transform "{}"` to disable babel-jest
entirely, so the browserslist code path is never loaded. Drop the now
redundant `--no-cache` flag, which only governed the transform cache.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
✅ Deploy Preview for testcontainers-node ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The
Smoke testsjob intermittently fails withSyntaxError: Invalid regular expression: missing /insidebrowserslist/node.js, before any test runs (Tests: 0 total). Example: run 28363763741.Root cause
The Jest CommonJS smoke test runs:
npm exec --yes --package jest@30.4.2installs jest and its entire transitive tree (including@babel/coreandbrowserslist) into the lockfile-less npx cache on every run — no integrity pinning. Jest's default transform loadsbabel-jest→@babel/core→@babel/helper-compilation-targets→browserslist, so an occasional corruptedbrowserslistin that cache fails the whole suite atrequiretime.Fix
smoke-test.jest.jsis plain CommonJS (require("./build/index")) that Node runs natively, so no transformation is needed. Passing--transform "{}"overrides Jest's defaultbabel-jesttransform with an empty map, so@babel/core/browserslistare never loaded and a corrupted cache copy can no longer break the run.The
--no-cacheflag is removed as redundant: it only governed the transform-output cache, which is moot once there are no transforms.--runInBandis kept (it runs the test in the main process rather than forking a worker).Scope
CI-only change; no source or test changes. The smoke test still verifies the same thing — that the built CommonJS package starts a container under the Jest runtime.
🤖 Generated with Claude Code