fix: unbreak yarn test:unit (jest 30.5.1 + cross-platform native bindings) - #2102
Merged
Conversation
jest-runtime 30.5.0 added splitQueryAndFragment(), which strips URL
query/fragment suffixes from import specifiers but scans from index 0.
A Node package-imports specifier such as chalk's "#supports-color" was
therefore read as a bare fragment, leaving an empty specifier that
resolved back to the importing module itself. chalk then imported its
own default export and died in the temporal dead zone:
ReferenceError: Cannot access 'supportsColor' before initialization
at node_modules/chalk/source/index.js:8:52
That broke every suite reaching chalk or ink: Table, DeleteBaseCommand,
config_builder and app/uninstall.
Upstream fixed it in 30.5.1 by starting the scan after a leading "#".
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
jest-resolve 30 resolves through unrs-resolver, a native module whose
binding is picked at install time. An install performed on macOS leaves
node_modules without a Linux binding, so jest-resolve silently returns
null on Linux and jest reports it as a missing transformer:
Module ts-jest in the transform option was not found.
This hits Linux CI and dev containers that share a node_modules or cache
produced on a macOS workstation. Declaring supportedArchitectures makes
one install cover darwin and linux on arm64 and x64, for unrs-resolver,
esbuild and @parcel/watcher alike.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
gandie
approved these changes
Sep 3, 2026
gandie
left a comment
Member
There was a problem hiding this comment.
tested locally, works.
much better fix. although i strongly dislike the fact that testing libs themselves break in such fashion. i went wrong with trusting those libs to just work out of the box, looking for errors rather on the consuming side of things. a failing testing lib during imports is a new level of chaos to manage for me 😆
LGTM!
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.
yarn test:unitcurrently fails. Two independent causes, one commit each.1.
ReferenceError: Cannot access 'supportsColor' before initializationjest-runtime@30.5.0(came in with #2094) addedsplitQueryAndFragment(), which strips URL query/fragment suffixes from import specifiers — but it scans from index 0. A Node package-imports specifier such as chalk's#supports-coloris therefore read as a bare fragment, leaving an empty specifier that resolves back to the importing module itself. chalk ends up importing its own default export and dies in the temporal dead zone:Every suite that reaches chalk or ink was affected:
Table,DeleteBaseCommand,config_builder,app/uninstall.Upstream fixed it in 30.5.1 by starting the scan after a leading
#:So this is just
yarn up jest @jest/globals. Ranges are bumped to^30.5.1so the fix cannot be silently lost by a downgrade.2.
Module ts-jest in the transform option was not foundjest-resolve@30resolves throughunrs-resolver, a native module whose platform binding is selected at install time. An install performed on macOS leavesnode_moduleswithout a Linux binding; on Linux the binding fails to load, the resolver silently returnsnull, and jest surfaces it as a missing transformer. This affects Linux CI and dev containers that share anode_modules/cache produced on a macOS workstation.Declaring
supportedArchitecturesin.yarnrc.ymlmakes a single install cover darwin + linux on arm64 + x64, forunrs-resolver,esbuildand@parcel/watcheralike. Cost is roughly 7 MB of extra binaries in the committed Yarn cache — happy to drop this commit if that trade isn't wanted.Verification
yarn test:unit— 20 suites, 153 tests, 0 failures (was: 4 suites failing)yarn compile— cleanyarn lint— clean🤖 Generated with Claude Code