Skip to content

Conversation

@ahnpnl
Copy link
Collaborator

@ahnpnl ahnpnl commented Sep 18, 2025

Summary

Closes #5049

Test plan

Green CI

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

N.A.

Summary by CodeRabbit

  • New Features

    • Introduced isolated modules mode across presets and examples.
    • Added options: useESM and stringifyContentPathRegex.
    • New isolated tsconfig files and example configs (CJS/ESM, monorepo, React, Babel, TS-only).
  • Documentation

    • Replaced “transpilation” with “isolatedModules” throughout.
    • Added deprecation notices and updated guidance/examples.
  • Chores

    • Migrated example/e2e configs to isolated modules; removed legacy transpiler configs.
    • Renamed example scripts to test-isolated/test-esm-isolated.
  • Tests

    • Updated test suites and messaging to align with isolated modules behavior.

@coderabbitai
Copy link

coderabbitai bot commented Sep 18, 2025

Walkthrough

Replaced the ts-jest “transpilation” option with TypeScript’s “isolatedModules” across configs, tests, and docs. Added isolated tsconfig variants. Updated example scripts/configs to “isolated” equivalents. Adjusted compiler warning gating to read isolatedModules from initial TS options. Revised messages, types, and tests accordingly. Removed obsolete transpiler configs.

Changes

Cohort / File(s) Summary
Core logic and types
src/legacy/compiler/ts-compiler.ts, src/types.ts
Compiler warning now checks initial TS options: uses isolatedModules + module kind; removed TsJestGlobalOptions.transpilation and retained isolatedModules (docs updated).
ConfigSet and tests
src/legacy/config/config-set.ts, src/legacy/config/config-set.spec.ts
When options.isolatedModules is provided, force parsed tsconfig isolatedModules=true; emit new deprecation messages (with/without tsconfig path). Tests updated to expect interpolated messages.
Messages
src/utils/messages.ts
Errors/Helps now reference isolatedModules; removed Deprecations.ReplaceIsolatedModulesWithTranspilation; added IsolatedModulesWithTsconfigPath/WithoutTsconfigPath.
Root Jest config
jest.config.ts
Transform options: add isolatedModules: true in tsconfig; remove transpilation: true.
Legacy compiler tests
src/legacy/compiler/ts-compiler.spec.ts
Tests updated to use isolatedModules; refactored diagnostics assertions and data setup.
E2E Jest transpiler configs (CJS/ESM)
e2e/*/jest-transpiler-*.config.ts, e2e/esm-features/jest-compiler-esm.config.ts, e2e/source-map/jest-transpiler-*.config.ts, e2e/test-utils/jest-transpiler-*.config.ts
Point ts-jest to new tsconfig-*-transpiler.spec.json; remove transpilation: true.
E2E tsconfig additions
e2e/**/tsconfig-*-transpiler.spec.json
New tsconfig variants extending existing ones; set compilerOptions.isolatedModules: true.
E2E const-enum test
e2e/const-enum/__tests__/const-enum.spec.ts
Use helper functions getOne/getTwo; test title simplified.
Examples: Jest configs
examples/**/jest-*-isolated.config.ts, examples/monorepo-app/**/jest-*-isolated.config.ts
Switch preset options from transpilation to tsconfig: '...-isolated...'; remove transpilation flags; add project aggregators for isolated variants.
Examples: removed transpiler aggregators
examples/monorepo-app/jest-esm-transpiler.config.ts, examples/monorepo-app/jest-transpiler.config.ts
Delete transpiler-based multi-project configs.
Examples: package scripts
examples/**/package.json, examples/package.json
Replace test-transpiler/* with test-isolated/*; update aggregate test-all to use isolated variants.
Examples: new tsconfigs
examples/**/tsconfig-*-isolated*.json
Add isolated tsconfig files extending existing configs with isolatedModules: true.
Docs (current)
website/docs/getting-started/options.md, website/docs/getting-started/options/isolatedModules.md, website/docs/getting-started/presets.md
Replace transpilation with isolatedModules; add stringifyContentPathRegex and useESM entries; update examples and option interfaces; note deprecation guidance.
Docs (versioned 29.4)
website/versioned_docs/version-29.4/getting-started/options*.md, website/versioned_docs/version-29.4/getting-started/presets.md
Same documentation updates mirrored in versioned docs.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant Jest
  participant TsJest as ts-jest Transformer
  participant TsCompiler
  participant TS as TypeScript

  Jest->>TsJest: transform(file, jestConfig)
  TsJest->>TsCompiler: getCompiledOutput(file, initialTsOptions)
  alt module in {Node16, NodeNext, Node18} AND isolatedModules is false
    TsCompiler-->>TsJest: warn(Helps.UsingModernNodeResolution)
  end
  TsCompiler->>TS: transpileModule(file, { isolatedModules })
  TS-->>TsCompiler: { outputText, sourceMapText, diagnostics }
  TsCompiler-->>TsJest: compiled output
  TsJest-->>Jest: transformed code
Loading
sequenceDiagram
  autonumber
  participant UserConfig as ts-jest Options
  participant ConfigSet
  participant FS as FileSystem
  participant Logger

  UserConfig->>ConfigSet: load(options)
  alt options.isolatedModules provided
    ConfigSet->>ConfigSet: parsedTsConfig.options.isolatedModules = true
    ConfigSet->>FS: check tsconfigFilePath exists?
    alt path exists
      ConfigSet->>Logger: deprecate(IsolatedModulesWithTsconfigPath{tsconfigFilePath})
    else no path
      ConfigSet->>Logger: deprecate(IsolatedModulesWithoutTsconfigPath)
    end
  end
  ConfigSet-->>UserConfig: resolved settings
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Suggested reviewers

  • kulshekhar

Poem

In burrows of configs, I hop and compile,
Swapping old flags with a carrot-bright smile.
Transpilers retire, isolation takes wing—
tsconfigs bloom, as the checks softly sing.
Thump-thump goes Jest on the gardened trail,
With enums and maps in a whiskered tale. 🥕🐇

Pre-merge checks and finishing touches

❌ Failed checks (1 warning, 1 inconclusive)
Check name Status Explanation Resolution
Out of Scope Changes Check ⚠️ Warning The diff touches a very large surface (public types, docs, many example and e2e configs, added/removed example config files and tsconfigs) that go well beyond the single reported regression about setupFiles matcher propagation; unless the explicit goal is to revert the entire 29.4.3 release, these widespread API/docs/config changes appear out-of-scope for the linked issue. If the intent is only to fix #5049, reduce the PR to the minimal runtime/config changes required to restore setupFiles behavior and move docs/API renames into a separate change; if the intent is to revert the whole 29.4.3 release, update the PR description to state that clearly and list the commits/files being reverted so reviewers can evaluate scope.
Linked Issues Check ❓ Inconclusive The PR states it reverts 29.4.3 to address issue #5049, but the supplied change summary shows broad option/type/docs/config edits (transpilation→isolatedModules, many tsconfig and preset updates) and does not show an explicit code change or test that directly demonstrates restoration of jest setupFiles matcher propagation described in #5049, so I cannot confirm from the provided diff that the linked issue is resolved. Please identify the exact commits being reverted, and include or reference a focused regression test (or CI output) that demonstrates setupFiles-imported matchers are again available in individual tests, or point to the specific runtime change that restores that behavior so reviewers can verify the fix.
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The title "revert 29.4.3 changes" is concise, a single short sentence, and clearly communicates the PR's primary intent to revert the changes introduced in version 29.4.3; it aligns with the PR objectives.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
✨ Finishing touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch revert-29.4.3-changes

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions
Copy link

github-actions bot commented Sep 18, 2025

PR Preview Action v1.6.2
Preview removed because the pull request was closed.
2025-09-19 13:46 UTC

@sonarqubecloud
Copy link

@ahnpnl ahnpnl marked this pull request as ready for review September 18, 2025 18:10
@ahnpnl ahnpnl requested a review from kulshekhar as a code owner September 18, 2025 18:10
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 10

🧹 Nitpick comments (20)
website/versioned_docs/version-29.4/getting-started/options/isolatedModules.md (2)

12-13: Nit: grammar tweak

“what TypeScript calls” → “which TypeScript calls”.

-But it can also be used to compile each file separately, what TypeScript calls an 'isolated module'.
+But it can also be used to compile each file separately, which TypeScript calls an 'isolated module'.

43-43: Nit: wording

“comparing to” → “compared to”.

-Using `isolatedModules: false` comes with a cost of performance comparing to `isolatedModules: true`. There is a way
+Using `isolatedModules: false` comes with a performance cost compared to `isolatedModules: true`. There is a way
src/types.ts (1)

80-87: Clarify behavior in JSDoc

Make it explicit that true switches to ts.transpileModule (no type-checking).

-   * Compiles files as isolated modules (disables some features)
+   * Compiles files as isolated modules (disables some features). When `true`, ts-jest uses TypeScript's `transpileModule` path (no type-checking).
website/docs/getting-started/options/isolatedModules.md (2)

12-13: Nit: grammar tweak

Same as versioned doc: “what TypeScript calls” → “which TypeScript calls”.

-But it can also be used to compile each file separately, what TypeScript calls an 'isolated module'.
+But it can also be used to compile each file separately, which TypeScript calls an 'isolated module'.

43-43: Nit: wording

“comparing to” → “compared to”.

-Using `isolatedModules: false` comes with a cost of performance comparing to `isolatedModules: true`. There is a way
+Using `isolatedModules: false` comes with a performance cost compared to `isolatedModules: true`. There is a way
src/utils/messages.ts (1)

31-32: Nit: clarify Node kinds in help text

Spell out the names and use “with” instead of “in” for readability.

-  UsingModernNodeResolution = 'Using hybrid module kind (Node16/18/Next) is only supported in "isolatedModules: true". Please set "isolatedModules: true" in your tsconfig.json.',
+  UsingModernNodeResolution = 'Using hybrid module kind (Node16, Node18, or NodeNext) is only supported with "isolatedModules: true". Please set "isolatedModules: true" in your tsconfig.json.',
e2e/esm-features/jest-transpiler-esm.config.ts (1)

4-12: Rename displayName — "transpiler" is misleading for an isolated-modules setup

Verified e2e/esm-features/tsconfig-esm-transpiler.spec.json sets "isolatedModules": true; update displayName in e2e/esm-features/jest-transpiler-esm.config.ts.

-  displayName: 'esm-features-transpiler-esm',
+  displayName: 'esm-features-esm-isolated',
e2e/transformer-in-ts/tsconfig-cjs-transpiler.spec.json (1)

1-6: Name consistency nit: consider “-isolated” suffix.
The file enables isolatedModules; naming it “...-isolated.spec.json” would align with other additions.

e2e/enum/tsconfig-cjs-transpiler.spec.json (1)

1-6: LGTM — optional: extract shared isolatedModules tsconfig
Many e2e//tsconfig--transpiler.spec.json files set "isolatedModules": true; consider extracting that into a shared base tsconfig to remove duplication if it doesn't hurt test clarity.

e2e/source-map/jest-transpiler-cjs.config.ts (1)

9-10: Path swap to tsconfig-cjs-transpiler.spec.json is fine; ensure source maps are enabled upstream.

This suite relies on accurate source maps; confirm the base/extended tsconfig sets sourceMap: true.

If not already, set sourceMap: true in the extended chain used by this config.

e2e/extend-ts-jest/jest-transpiler-esm.config.ts (1)

10-12: ESM transpiler config: consider limiting to TS or enable allowJs

Using TS_JS_TRANSFORM_PATTERN will transform .js as well. If not required here, prefer TS_TRANSFORM_PATTERN to reduce surface area; otherwise ensure the tsconfig enables allowJs.

- import { type JestConfigWithTsJest, TS_JS_TRANSFORM_PATTERN } from 'ts-jest'
+ import { type JestConfigWithTsJest, TS_TRANSFORM_PATTERN } from 'ts-jest'
 ...
-    [TS_JS_TRANSFORM_PATTERN]: [
+    [TS_TRANSFORM_PATTERN]: [
e2e/hoist-jest/jest-transpiler-cjs.config.ts (1)

9-10: CJS hoist config: good; optional tightening of transform pattern

Change looks good. If JS transformation isn’t needed in this suite, consider TS_TRANSFORM_PATTERN; otherwise ensure allowJs in the tsconfig.

- import { type JestConfigWithTsJest, TS_JS_TRANSFORM_PATTERN } from 'ts-jest'
+ import { type JestConfigWithTsJest, TS_TRANSFORM_PATTERN } from 'ts-jest'
 ...
-    [TS_JS_TRANSFORM_PATTERN]: [
+    [TS_TRANSFORM_PATTERN]: [
examples/react-app/jest-isolated.config.ts (1)

5-6: Use for consistency across configs.

Optional, but using absolute-from-rootDir paths avoids cwd surprises.

-  tsconfig: 'tsconfig-isolated.spec.json',
+  tsconfig: '<rootDir>/tsconfig-isolated.spec.json',
examples/ts-only/jest-esm-isolated.config.ts (1)

7-8: LGTM; standardize tsconfig path if desired.

Config is correct; consider prefixing with for consistency with other example/e2e files.

-    tsconfig: 'tsconfig-esm-isolated.json',
+    tsconfig: '<rootDir>/tsconfig-esm-isolated.json',
examples/js-with-ts/jest-isolated.config.ts (1)

7-8: Preset switch to tsconfig is correct; consider for path stability.

Minor consistency nit only.

-    tsconfig: 'tsconfig-isolated.json',
+    tsconfig: '<rootDir>/tsconfig-isolated.json',
examples/js-with-babel/jest-isolated.config.ts (1)

7-9: isolatedModules is enabled — OK; optional: add to tsconfig path.

examples/js-with-babel/tsconfig-isolated.json: compilerOptions.isolatedModules = true.

-    tsconfig: 'tsconfig-isolated.json',
+    tsconfig: '<rootDir>/tsconfig-isolated.json',
src/legacy/compiler/ts-compiler.ts (1)

196-199: Align isolatedModules source of truth with language-service gating

Ctor uses the tsconfig-derived configSet.isolatedModules (set from parsedTsConfig.options.isolatedModules in src/legacy/config/config-set.ts), but this warning checks this._initialCompilerOptions.isolatedModules — that can produce inconsistent warnings vs behavior. Use the tsconfig-derived configSet value for both checks (change the condition in src/legacy/compiler/ts-compiler.ts around lines ~196–199 to use configSet.isolatedModules).

website/docs/getting-started/presets.md (1)

132-134: Typo in example.

“optionsa” → “options”.

-const presetConfig = createDefaultLegacyPreset({
-  //...optionsa
-})
+const presetConfig = createDefaultLegacyPreset({
+  //...options
+})
src/legacy/compiler/ts-compiler.spec.ts (1)

105-175: Add a regression test for setupFiles matcher extensions (issue #5049).

To prove the revert, add an e2e that imports @testing-library/jest-dom in setupFiles and asserts matchers in a test without per‑file import. I can draft this if helpful.

website/versioned_docs/version-29.4/getting-started/options.md (1)

53-53: Fix option anchor to point back to transpilation page.

Anchor should align with the reverted option name.

-[isolatedmodules]: options/isolatedModules
+[transpilation]: options/transpilation
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 8a7e4c2 and d82c8c9.

📒 Files selected for processing (89)
  • e2e/const-enum/__tests__/const-enum.spec.ts (1 hunks)
  • e2e/const-enum/jest-transpiler-cjs.config.ts (1 hunks)
  • e2e/const-enum/jest-transpiler-esm.config.ts (1 hunks)
  • e2e/const-enum/tsconfig-cjs-transpiler.spec.json (1 hunks)
  • e2e/const-enum/tsconfig-esm-transpiler.spec.json (1 hunks)
  • e2e/enum/jest-transpiler-cjs.config.ts (1 hunks)
  • e2e/enum/jest-transpiler-esm.config.ts (1 hunks)
  • e2e/enum/tsconfig-cjs-transpiler.spec.json (1 hunks)
  • e2e/enum/tsconfig-esm-transpiler.spec.json (1 hunks)
  • e2e/esm-features/jest-compiler-esm.config.ts (1 hunks)
  • e2e/esm-features/jest-transpiler-esm.config.ts (1 hunks)
  • e2e/esm-features/tsconfig-esm-transpiler.spec.json (1 hunks)
  • e2e/extend-ts-jest/jest-transpiler-cjs.config.ts (1 hunks)
  • e2e/extend-ts-jest/jest-transpiler-esm.config.ts (1 hunks)
  • e2e/extend-ts-jest/tsconfig-cjs-transpiler.spec.json (1 hunks)
  • e2e/extend-ts-jest/tsconfig-esm-transpiler.spec.json (1 hunks)
  • e2e/hoist-jest/jest-transpiler-cjs.config.ts (1 hunks)
  • e2e/hoist-jest/tsconfig-cjs-transpiler.spec.json (1 hunks)
  • e2e/presets/jest-transpiler-cjs.config.ts (1 hunks)
  • e2e/presets/jest-transpiler-esm.config.ts (1 hunks)
  • e2e/presets/tsconfig-cjs-transpiler.spec.json (1 hunks)
  • e2e/presets/tsconfig-esm-transpiler.spec.json (1 hunks)
  • e2e/source-map/jest-transpiler-cjs.config.ts (1 hunks)
  • e2e/source-map/jest-transpiler-esm.config.ts (1 hunks)
  • e2e/source-map/tsconfig-cjs-transpiler.spec.json (1 hunks)
  • e2e/source-map/tsconfig-esm-transpiler.spec.json (1 hunks)
  • e2e/test-utils/jest-transpiler-cjs.config.ts (1 hunks)
  • e2e/test-utils/jest-transpiler-esm.config.ts (1 hunks)
  • e2e/test-utils/tsconfig-cjs-transpiler.spec.json (1 hunks)
  • e2e/test-utils/tsconfig-esm-transpiler.spec.json (1 hunks)
  • e2e/transform-js/jest-transpiler-cjs.config.ts (1 hunks)
  • e2e/transform-js/jest-transpiler-esm.config.ts (1 hunks)
  • e2e/transform-js/tsconfig-cjs-transpiler.spec.json (1 hunks)
  • e2e/transform-js/tsconfig-esm-transpiler.spec.json (1 hunks)
  • e2e/transformer-in-ts/jest-transpiler-cjs.config.ts (1 hunks)
  • e2e/transformer-in-ts/jest-transpiler-esm.config.ts (1 hunks)
  • e2e/transformer-in-ts/tsconfig-cjs-transpiler.spec.json (1 hunks)
  • e2e/transformer-in-ts/tsconfig-esm-transpiler.spec.json (1 hunks)
  • e2e/transformer-options/jest-transpiler-cjs.config.ts (1 hunks)
  • e2e/transformer-options/jest-transpiler-esm.config.ts (1 hunks)
  • e2e/transformer-options/tsconfig-cjs-transpiler.spec.json (1 hunks)
  • e2e/transformer-options/tsconfig-esm-transpiler.spec.json (1 hunks)
  • examples/js-with-babel/jest-esm-isolated.config.ts (1 hunks)
  • examples/js-with-babel/jest-isolated.config.ts (1 hunks)
  • examples/js-with-babel/package.json (1 hunks)
  • examples/js-with-babel/tsconfig-esm-isolated.json (1 hunks)
  • examples/js-with-babel/tsconfig-isolated.json (1 hunks)
  • examples/js-with-ts/jest-esm-isolated.config.ts (1 hunks)
  • examples/js-with-ts/jest-isolated.config.ts (1 hunks)
  • examples/js-with-ts/package.json (1 hunks)
  • examples/js-with-ts/tsconfig-esm-isolated.json (1 hunks)
  • examples/js-with-ts/tsconfig-isolated.json (1 hunks)
  • examples/monorepo-app/jest-esm-isolated.config.ts (1 hunks)
  • examples/monorepo-app/jest-esm-transpiler.config.ts (0 hunks)
  • examples/monorepo-app/jest-isolated.config.ts (1 hunks)
  • examples/monorepo-app/jest-transpiler.config.ts (0 hunks)
  • examples/monorepo-app/package.json (1 hunks)
  • examples/monorepo-app/type-commonjs/jest-esm-isolated.config.ts (1 hunks)
  • examples/monorepo-app/type-commonjs/jest-isolated.config.ts (1 hunks)
  • examples/monorepo-app/type-commonjs/tsconfig-esm-isolated.json (1 hunks)
  • examples/monorepo-app/type-commonjs/tsconfig-isolated.json (1 hunks)
  • examples/monorepo-app/type-module/jest-esm-isolated.config.ts (1 hunks)
  • examples/monorepo-app/type-module/jest-isolated.config.ts (1 hunks)
  • examples/monorepo-app/type-module/tsconfig-esm-isolated.json (1 hunks)
  • examples/monorepo-app/type-module/tsconfig-isolated.json (1 hunks)
  • examples/package.json (1 hunks)
  • examples/react-app/jest-esm-isolated.config.ts (1 hunks)
  • examples/react-app/jest-isolated.config.ts (1 hunks)
  • examples/react-app/package.json (1 hunks)
  • examples/react-app/tsconfig-esm-isolated.spec.json (1 hunks)
  • examples/react-app/tsconfig-isolated.spec.json (1 hunks)
  • examples/ts-only/jest-esm-isolated.config.ts (1 hunks)
  • examples/ts-only/jest-isolated.config.ts (1 hunks)
  • examples/ts-only/package.json (1 hunks)
  • examples/ts-only/tsconfig-esm-isolated.json (1 hunks)
  • examples/ts-only/tsconfig-isolated.json (1 hunks)
  • jest.config.ts (1 hunks)
  • src/legacy/compiler/ts-compiler.spec.ts (3 hunks)
  • src/legacy/compiler/ts-compiler.ts (1 hunks)
  • src/legacy/config/config-set.spec.ts (3 hunks)
  • src/legacy/config/config-set.ts (1 hunks)
  • src/types.ts (1 hunks)
  • src/utils/messages.ts (2 hunks)
  • website/docs/getting-started/options.md (2 hunks)
  • website/docs/getting-started/options/isolatedModules.md (3 hunks)
  • website/docs/getting-started/presets.md (25 hunks)
  • website/versioned_docs/version-29.4/getting-started/options.md (2 hunks)
  • website/versioned_docs/version-29.4/getting-started/options/isolatedModules.md (3 hunks)
  • website/versioned_docs/version-29.4/getting-started/presets.md (24 hunks)
💤 Files with no reviewable changes (2)
  • examples/monorepo-app/jest-esm-transpiler.config.ts
  • examples/monorepo-app/jest-transpiler.config.ts
🧰 Additional context used
🧬 Code graph analysis (4)
src/legacy/compiler/ts-compiler.ts (1)
src/transpilers/typescript/transpile-module.ts (1)
  • isModernNodeModuleKind (51-53)
src/legacy/config/config-set.ts (1)
src/utils/messages.ts (1)
  • interpolate (69-72)
src/legacy/config/config-set.spec.ts (2)
src/__helpers__/fakers.ts (1)
  • createConfigSet (42-74)
src/utils/messages.ts (1)
  • interpolate (69-72)
src/legacy/compiler/ts-compiler.spec.ts (1)
src/__helpers__/fakers.ts (1)
  • makeCompiler (77-104)
🪛 Biome (2.1.2)
e2e/const-enum/tsconfig-cjs-transpiler.spec.json

[error] 5-5: Expected a property but instead found '}'.

Expected a property here.

(parse)

e2e/const-enum/tsconfig-esm-transpiler.spec.json

[error] 5-5: Expected a property but instead found '}'.

Expected a property here.

(parse)

🔇 Additional comments (68)
e2e/transformer-options/tsconfig-esm-transpiler.spec.json (1)

1-6: LGTM.

Extends ESM spec tsconfig and enables isolatedModules. No issues spotted.

e2e/transform-js/tsconfig-cjs-transpiler.spec.json (1)

1-6: LGTM.

CJS variant mirrors the ESM one; consistent with the pattern elsewhere.

examples/monorepo-app/type-module/tsconfig-isolated.json (1)

1-6: LGTM.

Minimal isolated config extending the base; matches the new preset usage.

examples/js-with-ts/tsconfig-esm-isolated.json (1)

1-6: LGTM.

ESM isolated tsconfig is well-formed and aligned with the preset change.

examples/js-with-ts/jest-esm-isolated.config.ts (1)

6-8: Confirmed tsconfig presence. File examples/js-with-ts/tsconfig-esm-isolated.json exists and should be picked up by the preset.

examples/monorepo-app/jest-isolated.config.ts (1)

3-5: LGTM — project paths verified.
Both referenced configs exist at examples/monorepo-app/type-commonjs/jest-isolated.config.ts and examples/monorepo-app/type-module/jest-isolated.config.ts.

jest.config.ts (1)

15-21: Revert intent vs. change direction: confirm.

This adds isolatedModules: true (and per PR removes transpilation: true) while the PR title says “revert 29.4.3 changes.” Confirm intended direction and that this actually fixes #5049 (setupFiles-added matchers visible in tests). If the intent is to revert, restore the pre-29.4.3 config (drop isolatedModules, reintroduce transpilation: true) or update the PR title/description.

Verification summary: ran the suggested checks — found jest.config.ts uses setupFilesAfterEnv: '<rootDir>/src/__helpers__/setup-jest.ts' and examples/*/setupTests.ts imports @testing-library/jest-dom. The searches for matcher usage (toBeInTheDocument, toHaveAttribute) and expect.extend returned no matches and ripgrep reported “No files were searched,” so the result is inconclusive.

Action required: confirm intent (revert vs change) and either restore the old tsconfig options or update PR metadata. To validate the regression locally re-run matcher searches without type/ignore filters or run the test suite. Example check to run locally:
rg -nP 'toBeInTheDocument\(|toHaveAttribute\(|expect\.extend\(' -S --no-ignore -g '!/node_modules/'

examples/monorepo-app/type-module/jest-isolated.config.ts (1)

7-7: Verify isolated tsconfig presence and ESM settings

  • Confirmed: examples/monorepo-app/type-module/tsconfig-isolated.json exists and contains "isolatedModules": true (line 4).
  • Missing: no match for "module": "NodeNext"|"ESNext" or "moduleResolution": "NodeNext"|"Bundler" — ensure one of these is set (and that package.json has "type": "module" if required) to guarantee ESM/NodeNext compatibility.
  • Add a CI check that asserts the tsconfig file exists and contains the expected keys/values.
src/utils/messages.ts (1)

48-53: Deprecation messages: confirmed — old key removed, new messages wired

ReplaceIsolatedModulesWithTranspilation not found; IsolatedModulesWithTsconfigPath and IsolatedModulesWithoutTsconfigPath are defined and referenced.

Locations: src/utils/messages.ts:48,51; src/legacy/config/config-set.ts:220,225; src/legacy/config/config-set.spec.ts:1171,1195.

website/docs/getting-started/options.md (1)

44-45: Link target verified — no action required

Unversioned page website/docs/getting-started/options/isolatedModules.md exists and versioned copies (v28.0, v29.0, v29.2–29.4) are present; the [isolatedmodules] reference in getting-started/options.md resolves.

examples/package.json (1)

15-19: No changes required — example workspaces already include the scripts and configs. Verified each examples/* package.json defines test-isolated and test-esm-isolated, and corresponding jest-isolated.config.ts / jest-esm-isolated.config.ts files are present.

src/types.ts (1)

80-87: Deprecation text looks good — precedence verified

Using the ts-jest option isolatedModules=true emits the deprecation warning (with or without a tsconfig path) and sets parsedTsConfig.options.isolatedModules = true; if the ts-jest option is not used, the tsconfig value is respected (this.isolatedModules = parsedTsConfig.options.isolatedModules ?? false).

See: src/legacy/config/config-set.ts (constructor: handling of options.isolatedModules), src/utils/messages.ts (Deprecations.IsolatedModulesWithTsconfigPath / IsolatedModulesWithoutTsconfigPath), src/legacy/config/config-set.spec.ts (tests asserting the warnings).

e2e/extend-ts-jest/tsconfig-cjs-transpiler.spec.json (1)

1-6: LGTM: isolated CJS tsconfig for extend-ts-jest e2e.
Confirmed reference in e2e/extend-ts-jest/jest-transpiler-cjs.config.ts:9.

examples/js-with-babel/tsconfig-esm-isolated.json (1)

1-6: LGTM: isolatedModules override for ESM example is correct. Jest config and the npm test script reference the isolated tsconfig (examples/js-with-babel/jest-esm-isolated.config.ts and examples/js-with-babel/package.json); no behavioral risk.

e2e/source-map/tsconfig-esm-transpiler.spec.json (1)

1-6: LGTM: isolated ESM tsconfig for source-map e2e.
Both E2E configs reference tsconfig-esm-transpiler.spec.json (e2e/esm-features/jest-compiler-esm.config.ts:10, e2e/source-map/jest-transpiler-esm.config.ts:10). Matches intended "transpiler" test path.

examples/monorepo-app/type-commonjs/tsconfig-isolated.json (1)

1-6: LGTM: isolated override for CJS in monorepo app.
Jest references tsconfig-isolated.json at examples/monorepo-app/type-commonjs/jest-isolated.config.ts:7. Matches pattern used elsewhere.

examples/monorepo-app/type-commonjs/tsconfig-esm-isolated.json (1)

1-6: ESM config under "type-commonjs" — referenced by test config; no action required.
examples/monorepo-app/type-commonjs/jest-esm-isolated.config.ts references tsconfig-esm-isolated.json (line 7).

examples/ts-only/jest-isolated.config.ts (1)

6-8: Approve — tsconfig-based isolated setup verified.
examples/ts-only/tsconfig-isolated.json present; no occurrences of "transpilation: true" found outside node_modules.

examples/react-app/tsconfig-esm-isolated.spec.json (1)

1-6: LGTM — isolatedModules enabled; JSX confirmed in base tsconfig (examples/react-app/tsconfig.json contains "jsx": "react-jsx").
examples/react-app/tsconfig-esm-isolated.spec.json → extends ./tsconfig-esm.spec.json → ./tsconfig.spec.json → ./tsconfig.json which sets JSX.

examples/react-app/jest-esm-isolated.config.ts (1)

5-5: Keep the .spec tsconfig — no change needed.
examples/react-app/tsconfig-esm-isolated.spec.json exists; keep the tsconfig entry as-is.

Likely an incorrect or invalid review comment.

examples/ts-only/tsconfig-esm-isolated.json (1)

1-6: LGTM — confirm consumer config references this file

Script returned no output; unable to confirm examples/ts-only/tsconfig-esm.json exists or that the examples/ts-only jest-esm-isolated config references examples/ts-only/tsconfig-esm-isolated.json. Verify those paths and update consumer config if needed.

e2e/transformer-in-ts/tsconfig-esm-transpiler.spec.json (1)

1-6: LGTM — please confirm tsconfig presence and consumer references.

Sandbox verification returned no hits; confirm e2e/tsconfig-esm.spec.json (or ../tsconfig-esm.spec.json relative to e2e/transformer-in-ts) exists and that consumers reference e2e/transformer-in-ts/tsconfig-esm-transpiler.spec.json.

e2e/hoist-jest/tsconfig-cjs-transpiler.spec.json (1)

1-6: LGTM — config wiring verified.
e2e/hoist-jest/tsconfig-cjs.spec.json exists and e2e/hoist-jest/jest-transpiler-cjs.config.ts references '/tsconfig-cjs-transpiler.spec.json'.

examples/monorepo-app/type-module/tsconfig-esm-isolated.json (1)

1-6: LGTM — verify Jest config references this tsconfig

examples/monorepo-app/type-module/tsconfig-esm-isolated.json exists and sets "isolatedModules": true (it extends tsconfig-esm.json). I could not find jest-esm-isolated.config.ts or any repo reference to "tsconfig-esm-isolated.json"; verify the package's Jest config points to this filename.
examples/monorepo-app/type-module/tsconfig-esm-isolated.json
examples/monorepo-app/type-module/tsconfig-esm.json

e2e/transformer-options/tsconfig-cjs-transpiler.spec.json (1)

1-6: LGTM — Jest config already points to this tsconfig.
e2e/transformer-options/jest-transpiler-cjs.config.ts → tsconfig: '/tsconfig-cjs-transpiler.spec.json'; jest-e2e-cjs.config.ts includes 'e2e/**/jest-transpiler-cjs.config.ts'.

e2e/enum/jest-transpiler-cjs.config.ts (1)

9-10: LGTM — ensure transpilation: true is removed repo‑wide.
My rg check returned "No files were searched" (ripgrep applied ignore filters), so I couldn't verify; run an unrestricted search (e.g. rg -uu --hidden -nP 'transpilation\s*:' or git grep -n 'transpilation') and confirm no instances remain.

examples/ts-only/tsconfig-isolated.json (1)

1-6: LGTM: minimal isolatedModules overlay looks correct.
No further changes needed here.

examples/js-with-ts/tsconfig-isolated.json (1)

1-6: LGTM: matches the base pattern and keeps scope tight.
Confirm jest-isolated config references this path.

e2e/presets/tsconfig-cjs-transpiler.spec.json (1)

1-6: LGTM: CJS preset overlay is valid.
No trailing commas; path resolution looks fine.

e2e/enum/tsconfig-esm-transpiler.spec.json (1)

1-6: LGTM: ESM overlay mirrors other directories consistently.
Nothing else to flag.

e2e/transform-js/jest-transpiler-esm.config.ts (1)

10-12: Config aligns with ESM transform — referenced tsconfig present.
e2e/transform-js/tsconfig-esm-transpiler.spec.json confirmed present (verification script returned no output).

e2e/source-map/jest-transpiler-esm.config.ts (1)

10-12: Transform config update looks good — confirm repo‑wide removal of deprecated transpilation flag.
Switched tsconfig/useESM here; no active transpilation config/property found, but the term remains in documentation/changelog (CHANGELOG.md, website/docs/** and website/versioned_docs/** — e.g. guides/troubleshooting.md, guides/esm-support.md, processing.md).

examples/js-with-babel/tsconfig-isolated.json (1)

1-6: LGTM: Babel example overlay is minimal and correct — verified jest configs.
examples/js-with-babel/jest-isolated.config.ts contains babelConfig: true and tsconfig: 'tsconfig-isolated.json'; no jest-esm-isolated config found in examples/js-with-babel.

e2e/const-enum/tsconfig-esm-transpiler.spec.json (1)

1-6: Fix JSON trailing comma (parse error).
Trailing comma after "isolatedModules": true makes this file invalid JSON — remove the comma.

File: e2e/const-enum/tsconfig-esm-transpiler.spec.json (lines 1-6)

Apply:

 {
   "extends": "./tsconfig-esm.spec.json",
   "compilerOptions": {
-    "isolatedModules": true,
+    "isolatedModules": true
   }
 }
e2e/test-utils/jest-transpiler-esm.config.ts (1)

10-12: Consistent ESM transpiler tsconfig usage.

Correct pairing of useESM with isolated tsconfig.

e2e/extend-ts-jest/jest-transpiler-cjs.config.ts (1)

9-10: CJS transpiler config aligned with isolated tsconfig.

Configuration is consistent with the broader revert/migration.

e2e/test-utils/tsconfig-cjs-transpiler.spec.json (1)

1-6: LGTM: isolated CJS tsconfig added.

Keeps behavior consistent with other CJS e2e suites.

e2e/transform-js/tsconfig-esm-transpiler.spec.json (1)

1-6: LGTM: isolated ESM tsconfig for transform-js.

Matches the ESM pattern used elsewhere.

e2e/esm-features/jest-compiler-esm.config.ts (1)

10-12: Approve — tsconfig-esm-transpiler.spec.json present and isolatedModules=true.
Ensures config parity with other ESM suites.

examples/react-app/tsconfig-isolated.spec.json (1)

1-6: LGTM: isolated tsconfig for the React example — confirm Jest config & scripts reference it
Search found no references to examples/react-app/tsconfig-isolated.spec.json; confirm examples/react-app Jest config (jest.config.js or package.json "jest" field) and package.json scripts point to this file or update them.

e2e/esm-features/tsconfig-esm-transpiler.spec.json (1)

1-6: LGTM: minimal isolatedModules overlay

Extends path and option look correct.

e2e/presets/tsconfig-esm-transpiler.spec.json (1)

1-6: LGTM

Consistent with the other ESM overlays.

e2e/extend-ts-jest/tsconfig-esm-transpiler.spec.json (1)

1-6: LGTM

Matches the pattern used elsewhere; no issues spotted.

e2e/presets/jest-transpiler-esm.config.ts (1)

10-12: Confirm revert intent: transpilation removal?

File: e2e/presets/jest-transpiler-esm.config.ts (lines 10–12). Your rg run returned "No files were searched" so repo-wide verification was inconclusive — confirm whether dropping transpilation: true is intentional for this revert; otherwise restore:

       {
         tsconfig: '<rootDir>/tsconfig-esm-transpiler.spec.json',
         useESM: true,
+        transpilation: true,
       },
e2e/const-enum/__tests__/const-enum.spec.ts (1)

4-10: LGTM — small helper extraction OK; verify preserveConstEnums=false

Couldn't read e2e/const-enum tsconfigs (permission denied); confirm compilerOptions.preserveConstEnums is set to false in e2e/const-enum/tsconfig-esm-transpiler.spec.json and e2e/const-enum/tsconfig-cjs-transpiler.spec.json (or their extended configs) so const-enum inlining is validated under isolatedModules/transpile.

e2e/presets/jest-transpiler-cjs.config.ts (1)

9-10: CJS preset: confirm revert intent mirrors ESM

Neither e2e/presets/jest-transpiler-cjs.config.ts nor e2e/presets/jest-transpiler-esm.config.ts define a transpilation property — confirm whether transpilation: true should be restored to the CJS preset (and to ESM if you want the revert to be symmetric).

examples/js-with-babel/jest-esm-isolated.config.ts (1)

8-9: Confirmed: tsconfig exists and correctly configures ESM + isolatedModules

examples/js-with-babel/tsconfig-esm-isolated.json exists, sets "isolatedModules": true, and extends ./tsconfig-esm.json (which sets "module": "ESNext").

e2e/transformer-in-ts/jest-transpiler-esm.config.ts (1)

10-10: ESM tsconfig switch looks right; confirm file presence and ESM settings

Change is fine. Ensure tsconfig-esm-transpiler.spec.json exists alongside this config and carries isolatedModules: true; keep useESM aligned with module settings in that tsconfig.

examples/monorepo-app/type-module/jest-esm-isolated.config.ts (1)

7-7: Preset now driven by tsconfig — good

Looks good. Confirm tsconfig-esm-isolated.json sets module resolution for ESM (e.g., module: node16/nodeNext or ESNext) and isolatedModules: true.

examples/monorepo-app/type-commonjs/jest-isolated.config.ts (1)

7-7: CJS preset tsconfig switch — OK

Ensure tsconfig-isolated.json aligns with CJS (module: commonjs) and sets isolatedModules: true.

e2e/transformer-in-ts/jest-transpiler-cjs.config.ts (1)

9-9: CJS transformer config — tsconfig swap LGTM

Path update is consistent with the revert. Verify tsconfig-cjs-transpiler.spec.json exists and contains isolatedModules: true; hoist-jest transformer path remains valid.

e2e/transformer-options/jest-transpiler-cjs.config.ts (1)

10-20: Check FormatJS transformer compatibility under isolated modules

The tsconfig change is fine. Please confirm @formatjs/ts-transformer still runs as expected when using transpile-only/isolatedModules; some transformers require type info and may differ.

e2e/const-enum/jest-transpiler-cjs.config.ts (1)

9-10: Good revert to dedicated tsconfig — confirm tsconfig exists and isolatedModules is true

  • Ensure e2e/const-enum/jest-transpiler-cjs.config.ts references '/tsconfig-cjs-transpiler.spec.json' and that that tsconfig file exists and sets "isolatedModules": true.
  • If any config still uses TS_JS_TRANSFORM_PATTERN, either set "allowJs": true in the referenced tsconfig or replace usages/imports with TS_TRANSFORM_PATTERN (example diff below).
- import { type JestConfigWithTsJest, TS_JS_TRANSFORM_PATTERN } from 'ts-jest'
+ import { type JestConfigWithTsJest, TS_TRANSFORM_PATTERN } from 'ts-jest'
 ...
-    [TS_JS_TRANSFORM_PATTERN]: [
+    [TS_TRANSFORM_PATTERN]: [
examples/monorepo-app/type-commonjs/jest-esm-isolated.config.ts (1)

7-8: LGTM; consistent ESM preset usage.
Confirmed examples/monorepo-app/type-commonjs/tsconfig-esm-isolated.json exists and compilerOptions.isolatedModules is true.

e2e/transform-js/jest-transpiler-cjs.config.ts (1)

9-10: CJS transpiler path correct — tsconfig present; verify repo‑wide removal of transpilation: flags.

e2e/transform-js/jest-transpiler-cjs.config.ts points to '/tsconfig-cjs-transpiler.spec.json' and e2e/transform-js/tsconfig-cjs-transpiler.spec.json exists; automated search didn't scan files (rg reported "No files were searched") — run a repo-wide grep for transpilation: to confirm.

e2e/enum/jest-transpiler-esm.config.ts (1)

10-12: tsconfig verified; no setupFiles in this config — confirm matcher registration

  • Verified: e2e/enum/tsconfig-esm-transpiler.spec.json exists and compilerOptions.isolatedModules = true.
  • Observed: e2e/enum/jest-transpiler-esm.config.ts has no setupFiles or setupFilesAfterEnv. Ensure the setup file that registers matcher extensions (calls expect.extend or imports jest-extended) is applied when running tests with this config — either add the setup file to this config or confirm it’s provided by a root/preset config so this revert actually addresses #5049.
src/legacy/config/config-set.spec.ts (3)

14-14: Import of interpolate is correct

Importing interpolate for dynamic deprecation messages is appropriate.


1153-1177: Good deprecation coverage when tsconfig path exists

Test clearly asserts Deprecations.IsolatedModulesWithTsconfigPath with formatted path; nice.


1195-1196: Good deprecation coverage when tsconfig path is absent

Expectation matches the new message key.

examples/react-app/package.json (1)

9-12: React app scripts—isolated configs present
Both jest-isolated.config.ts and jest-esm-isolated.config.ts are present at examples/react-app/.

examples/monorepo-app/jest-esm-isolated.config.ts (1)

1-8: Config wrapper verified — child configs exist

Both referenced files are present: examples/monorepo-app/type-commonjs/jest-esm-isolated.config.ts and examples/monorepo-app/type-module/jest-esm-isolated.config.ts.

e2e/transformer-options/jest-transpiler-esm.config.ts (1)

11-11: tsconfig file present — no action required
tsconfig-esm-transpiler.spec.json exists at e2e/transformer-options/tsconfig-esm-transpiler.spec.json.

e2e/test-utils/jest-transpiler-cjs.config.ts (1)

9-10: CJS transpiler tsconfig path exists — no action required.
Confirmed e2e/test-utils/tsconfig-cjs-transpiler.spec.json is present.

examples/monorepo-app/package.json (1)

12-15: New isolated scripts — top-level configs are present
Found examples/monorepo-app/jest-isolated.config.ts and examples/monorepo-app/jest-esm-isolated.config.ts (also present under type-commonjs/ and type-module/).

website/versioned_docs/version-29.4/getting-started/presets.md (1)

33-34: Docs: isolatedModules links/types verified — no transpilation found

  • website/versioned_docs/version-29.4/getting-started/options/isolatedModules.md exists.
  • Public type: src/types.ts:86 — isolatedModules?: boolean; raw option: src/raw-compiler-options.ts:293 — isolatedModules?: boolean | null.
  • No transpilation occurrences found in src.
examples/js-with-ts/package.json (1)

7-9: Incorrect — repository already reverted to isolated configs.
examples/js-with-ts/package.json already has "test-isolated" and "test-esm-isolated", isolated Jest configs exist (jest-isolated.config.ts, jest-esm-isolated.config.ts), and commit d82c8c9 reverts the transpilation change; restoring "transpiler" scripts is not applicable.

Likely an incorrect or invalid review comment.

examples/ts-only/package.json (2)

7-9: Config files present — run example tests locally

Found examples/ts-only/jest-isolated.config.ts and examples/ts-only/jest-esm-isolated.config.ts (with tsconfig-isolated.json and tsconfig-esm-isolated.json); the package.json scripts reference them. Run in examples/ts-only: npm run test-isolated and npm run test-esm-isolated to confirm the examples pass.


7-9: Fix Jest/ts-jest version mismatch in examples/ts-only/package.json.
ts-jest 29.x does not support Jest 30 — update ts-jest to ^30.x or downgrade jest to ^29.x so the examples' declared versions are compatible.

⛔ Skipped due to learnings
Learnt from: ahnpnl
PR: kulshekhar/ts-jest#4976
File: examples/js-with-babel/package.json:14-19
Timestamp: 2025-08-05T08:03:52.583Z
Learning: ts-jest version 29 supports both Jest 29 and Jest 30, so having ts-jest 29.x with Jest 30.x is not a compatibility issue and should not be flagged as a version mismatch problem.

@ahnpnl
Copy link
Collaborator Author

ahnpnl commented Sep 19, 2025

@kulshekhar we need to revert this ASAP 😄

@ahnpnl ahnpnl merged commit 25cb706 into main Sep 19, 2025
22 checks passed
@ahnpnl ahnpnl deleted the revert-29.4.3-changes branch September 19, 2025 13:45
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.

[Bug]: Something changed with version 29.4.3 where imports from jest setupFiles that are scoped to the imported file

3 participants