Skip to content

Fix intermittent Jest smoke test failures#1395

Merged
cristianrgreco merged 1 commit into
mainfrom
fix-smoke-test-jest-flake
Jun 29, 2026
Merged

Fix intermittent Jest smoke test failures#1395
cristianrgreco merged 1 commit into
mainfrom
fix-smoke-test-jest-flake

Conversation

@cristianrgreco

Copy link
Copy Markdown
Collaborator

Summary

The Smoke tests job intermittently fails with SyntaxError: Invalid regular expression: missing / inside browserslist/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.2 -- jest --testMatch "**/smoke-test.jest.js" --runInBand --no-cache

npm exec --yes --package jest@30.4.2 installs jest and its entire transitive tree (including @babel/core and browserslist) into the lockfile-less npx cache on every run — no integrity pinning. Jest's default transform loads babel-jest@babel/core@babel/helper-compilation-targetsbrowserslist, so an occasional corrupted browserslist in that cache fails the whole suite at require time.

Fix

smoke-test.jest.js is plain CommonJS (require("./build/index")) that Node runs natively, so no transformation is needed. Passing --transform "{}" overrides Jest's default babel-jest transform with an empty map, so @babel/core/browserslist are never loaded and a corrupted cache copy can no longer break the run.

The --no-cache flag is removed as redundant: it only governed the transform-output cache, which is moot once there are no transforms. --runInBand is 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

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>
@netlify

netlify Bot commented Jun 29, 2026

Copy link
Copy Markdown

Deploy Preview for testcontainers-node ready!

Name Link
🔨 Latest commit 79d4e32
🔍 Latest deploy log https://app.netlify.com/projects/testcontainers-node/deploys/6a424601fd97d0000825b99f
😎 Deploy Preview https://deploy-preview-1395--testcontainers-node.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@cristianrgreco cristianrgreco added maintenance Improvements that do not change functionality github_actions Pull requests that update GitHub Actions code and removed github_actions Pull requests that update GitHub Actions code labels Jun 29, 2026
@cristianrgreco cristianrgreco merged commit 4286661 into main Jun 29, 2026
517 of 519 checks passed
@cristianrgreco cristianrgreco deleted the fix-smoke-test-jest-flake branch June 29, 2026 11:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

maintenance Improvements that do not change functionality

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant