-
-
Notifications
You must be signed in to change notification settings - Fork 16
Description
Bug Report
Summary
synckit@0.11.10 (released July 18, 2025) introduced a breaking change that causes Jest v30 tests to fail with a createRequire TypeError. This is due to updating the @pkgr/core dependency to a version incompatible with Jest's module loading.
Error Message
TypeError: The argument 'filename' must be a file URL object, file URL string, or absolute path string. Received 'http://localhost/index.cjs'
at Function.createRequire (node_modules/jest-runtime/build/index.js:1407:23)
at Object.<anonymous> (node_modules/@pkgr/core/lib/index.cjs:10:48)
at Object.<anonymous> (node_modules/synckit/lib/index.cjs:30:29)
at _jestSnapshot (node_modules/@jest/expect/build/index.js:29:16)
at createJestExpected (node_modules/@jest/expect/build/index.js:44:28)
at node_modules/@jest/expect/build/index.js:52:41
at node_modules/@jest/expect/build/index.js:53:3
at Object.<anonymous> (node_modules/@jest/expect/build/index.js:56:12)
Environment
- synckit version: 0.11.10 (broken), 0.11.9 (works)
- Jest version: 30.0.2+
- @pkgr/core version: 0.3.4 (broken), 0.2.9 (works)
- Node.js version: Latest
- Package manager: Any (affects pnpm, npm, yarn)
Root Cause Analysis
- June 1, 2025:
@pkgr/core@0.3.0introduced breaking changes with Jest'screateRequireimplementation - July 18, 2025:
synckit@0.11.10updated its dependency range to allow@pkgr/core@0.3.x, pulling in the incompatible version - Dependency chain: Jest v30 → @jest/expect → jest-snapshot → synckit → @pkgr/core
Reproduction Repository
I've created a complete reproduction case: https://github.com/FrozenPandaz/jest-synckit-issue
Steps to Reproduce
- Clone the reproduction repository
- Remove the pnpm override from
package.json - Delete
pnpm-lock.yamland runpnpm install - Run either:
nx test test(NX command)cd apps/test && TS_NODE_COMPILER_OPTIONS='{"moduleResolution":"node10","module":"commonjs","customConditions":null}' npx jest(Jest directly)
Both will fail with the createRequire error above.
Expected Behavior
Tests should run successfully as they did with synckit@0.11.9
Actual Behavior
Jest tests fail to start due to module loading errors in the synckit → @pkgr/core dependency chain
Current Workaround
Pin synckit to the last working version using package manager overrides:
For pnpm:
{
"pnpm": {
"overrides": {
"synckit": "0.11.8"
}
}
}For npm:
{
"overrides": {
"synckit": "0.11.8"
}
}For yarn:
{
"resolutions": {
"synckit": "0.11.8"
}
}Suggested Fix
Update synckit's dependency on @pkgr/core to exclude the problematic 0.3.x versions until they resolve Jest compatibility. For example:
- Pin to
@pkgr/core: "^0.2.0" - Or exclude broken versions:
@pkgr/core: "^0.3.0 \!=0.3.0 \!=0.3.1 \!=0.3.2 \!=0.3.3 \!=0.3.4"
Impact
- Affects all Jest v30 users who depend on packages using synckit
- Common in NX projects, ESLint configurations, and other tooling
- Breaking change appeared suddenly on July 18, 2025 with synckit@0.11.10 release
Additional Context
- This only surfaced yesterday due to synckit@0.11.10 updating its dependency range
- @pkgr/core versions 0.3.0+ are incompatible with Jest v30's createRequire implementation
- The issue occurs in Jest's core initialization, not user configuration
- No Jest configuration workaround exists that avoids this dependency chain
Related Issues
- Similar createRequire issues in Jest: Override
module.createRequirejestjs/jest#9426 - This affects any test runner using similar module loading patterns
Thank you for maintaining synckit! This library is widely used and this compatibility fix would help many Jest v30 users.