Skip to content

fix(tests): drop unused ts-jest transform from shared jest preset - #382

Merged
so0k merged 1 commit into
open-constructs:mainfrom
deejayem:fix-jest-preset-ts-jest
Aug 16, 2026
Merged

so0k merged 1 commit into
open-constructs:mainfrom
deejayem:fix-jest-preset-ts-jest

Conversation

@deejayem

Copy link
Copy Markdown
Contributor

nxPreset registers a ts-jest transform, but every project in this workspace overrides it with its own @swc/jest transform, so the entry is resolved by jest at startup yet never executed. ts-jest is not a dependency of any of these projects — it is only pulled in transitively by one example's devDependencies — so any install that does not include that example (e.g. pnpm install --filter "cdktn-cli...") makes every test run fail at config load with "Module ts-jest in the transform option was not found".

Override the inherited transform with an empty map; each project supplies its own.

Related issue

Fixes #381

Description

Make the jest.preset.js transform an empty map.

Checklist

  • I have updated the PR title to match CDKTN's style guide
  • I have run the linter on my code locally
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas - n/a, the change is too small to need it
  • I have made corresponding changes to the documentation if applicable - n/a, none needed
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works if applicable - n/a, this is tested by existing tests passing when using --filter
  • New and existing unit tests pass locally with my changes

nxPreset registers a ts-jest transform, but every project in this
workspace overrides it with its own @swc/jest transform, so the entry
is resolved by jest at startup yet never executed. ts-jest is not a
dependency of any of these projects — it is only pulled in
transitively by one example's devDependencies — so any install that
does not include that example (e.g. `pnpm install --filter
"cdktn-cli..."`) makes every test run fail at config load with
"Module ts-jest in the transform option was not found".

Override the inherited transform with an empty map; each project
supplies its own.

Fixes open-constructs#381
@sakul-learning

Copy link
Copy Markdown
Contributor

Verified the reported failure against the PR's merge base (358edc7c39b0b380ba89fd31881f0577fe9b6214) and the fix at head (99e71a15f91133fa0ddeb02a9f843d54120f7b3c) using separate clean source archives.

Reproduction for each revision:

corepack pnpm install --filter "cdktn-cli..." --frozen-lockfile --ignore-scripts
corepack pnpm --filter cdktn-cli exec jest --config jest.config.js --showConfig
  • Merge base: the filtered install succeeded, but loading packages/cdktn-cli/jest.config.js exited 1 with Module ts-jest in the transform option was not found. Jest reported <rootDir> as packages/cdktn-cli.
  • PR head: the same filtered install and Jest configuration load both succeeded. The resolved transform contains only the package's @swc/jest transformer.

I also checked every current consumer of the root jest.preset.js: all nine package Jest configurations provide their own @swc/jest transform, so clearing the inherited Nx ts-jest transform does not remove a transformer any current consumer relies on.

Configured verification on the PR head also passed:

  • pnpm exec jest packages/cdktn/test/validations.test.ts --runInBand — 1 suite, 41 tests, 11 snapshots
  • pnpm exec nx build cdktn — successful, 0 errors
  • pnpm exec nx test cdktn --runInBand — 43 suites, 542 tests, 301 snapshots

No correctness, security, or artifact-value findings. The one-line transform: {} override is the minimal fix for the reproduced filtered-install failure. Verdict: approve.

@so0k
so0k enabled auto-merge (squash) August 16, 2026 11:39
@so0k
so0k merged commit 03f6e16 into open-constructs:main Aug 16, 2026
512 of 514 checks passed
@deejayem
deejayem deleted the fix-jest-preset-ts-jest branch August 17, 2026 06:44
@github-actions

Copy link
Copy Markdown
Contributor

I'm going to lock this pull request because it has been closed for 30 days. This helps our maintainers find and focus on the active issues. If you've found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Sep 17, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

tests: jest fails to start after a filtered pnpm install ("Module ts-jest in the transform option was not found")

3 participants