Fix Jest ESM transformation for three.js and consolidate TypeScript to 5.6 (fixes #724) #768
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
This PR fixes CI test failures reported in #724 caused by Jest attempting to execute untransformed ESM modules from three/examples/jsm/*, and consolidates the TypeScript version across the repository to a single, consistent version.
The changes unblock upgrading TypeScript (≥5.6) and Jest while keeping the existing tooling setup (ts-jest) intact.
What was fixed
Tests importing ESM-only modules from three/examples/jsm/* (for example
OutlinePass.js) were failing with:SyntaxError: Cannot use import statement outside a moduleThe root cause was an overly narrow transformIgnorePatterns regex that did not reliably match nested paths such as:
three/examples/jsm/postprocessing/OutlinePass.jsFix:
The Jest configuration was updated to explicitly allow transforming all nested three/examples/jsm paths so they are handled correctly by ts-jest.
This resolves the ESM parsing error without introducing Babel or changing test logic.
TypeScript was previously declared in multiple places (root and sub-packages), which made version upgrades harder and could lead to resolution ambiguity.
Fix:
With Yarn workspaces, the root TypeScript dependency is hoisted and available to all packages automatically.
Why remaining test output errors are not related to TypeScript:
Some errors seen during yarn install / local test runs are unrelated to TypeScript and remain unchanged by this PR:
These are environment-specific native build issues and occur during the install/build phase, not during TypeScript compilation or Jest execution.
These are informational warnings that existed prior to this change and do not affect TypeScript resolution.
Evidence TypeScript is resolved:
Scope and impact