Skip to content

Conversation

@remo-lab
Copy link

@remo-lab remo-lab commented Jan 1, 2026

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

  1. Jest ESM module transformation (Issue Updating ts or jest seems to break tests #724)

Tests importing ESM-only modules from three/examples/jsm/* (for example OutlinePass.js) were failing with:
SyntaxError: Cannot use import statement outside a module

The root cause was an overly narrow transformIgnorePatterns regex that did not reliably match nested paths such as:
three/examples/jsm/postprocessing/OutlinePass.js

Fix:
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.

  1. TypeScript version consolidation

TypeScript was previously declared in multiple places (root and sub-packages), which made version upgrades harder and could lead to resolution ambiguity.

Fix:

  • TypeScript is now declared only once, in the root package.json (devDependencies: ~5.6.0)
  • Removed TypeScript from all sub-package package.json files
    With Yarn workspaces, the root TypeScript dependency is hoisted and available to all packages automatically.
Screenshot 2026-01-01 145120 Screenshot 2026-01-01 145103 Screenshot 2026-01-01 145036 Screenshot 2026-01-01 145015

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:

  • Native module build failures (cypress, canvas, esbuild, sharp)
    These are environment-specific native build issues and occur during the install/build phase, not during TypeScript compilation or Jest execution.
  • Peer dependency warnings (Angular tooling, compodoc, jsroot)
    These are informational warnings that existed prior to this change and do not affect TypeScript resolution.

Evidence TypeScript is resolved:

  • No TypeScript-related warnings during Yarn resolution
  • No “package X doesn’t provide typescript” messages
  • A single hoisted TypeScript version is used by all workspaces
  • ts-jest and Angular tooling can resolve TypeScript correctly

Scope and impact

@remo-lab
Copy link
Author

remo-lab commented Jan 1, 2026

Hi! @EdwardMoyse 👋
This PR fixes the Jest ESM transformation issue reported in #724 and consolidates TypeScript to a single root version (5.6.x).
The change is configuration-only, keeps ts-jest, and resolves the three/examples/jsm/* import failures.
I’d appreciate a review when you have time — thanks!

@remo-lab remo-lab force-pushed the fix/jest-esm-transform-and-ts-5-6 branch from ec6497e to a346625 Compare January 1, 2026 10:28
@remo-lab
Copy link
Author

remo-lab commented Jan 1, 2026

@EdwardMoyse Just to clarify the second commit: it updates yarn.lock to match the dependency resolution after the Jest config change and the TypeScript version consolidation.

CI runs yarn install in immutable mode, so without this lockfile update the build fails even though the config changes are correct. No dependencies were added or removed beyond what’s required to keep the lockfile in sync.

@remo-lab remo-lab force-pushed the fix/jest-esm-transform-and-ts-5-6 branch from 774e41e to 3382068 Compare January 1, 2026 11:37
@remo-lab remo-lab force-pushed the fix/jest-esm-transform-and-ts-5-6 branch from 3382068 to 8ee20de Compare January 1, 2026 11:46
@EdwardMoyse
Copy link
Collaborator

Thanks @remo-lab - unfortunately the CI still reports many errors, which I believe I can reproduce locally with yarn test:ci

@remo-lab remo-lab closed this Jan 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants