Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ESM mode: let TypeScript emit ESM codes always when using with Babel #2650

Closed
herschel666 opened this issue Jun 1, 2021 · 10 comments · Fixed by #2661
Closed

ESM mode: let TypeScript emit ESM codes always when using with Babel #2650

herschel666 opened this issue Jun 1, 2021 · 10 comments · Fixed by #2661
Labels
🚀 Feature Request new suggested feature

Comments

@herschel666
Copy link

herschel666 commented Jun 1, 2021

🚀 Feature Proposal

From my point of view this is a regression, but I guess you had good reasons to bind the module type to the supportsStaticESM-option of Jest. That's why I'm proposing it as a feature: allow to have moduleKind be ESNext independent of Jest's supportsStaticESM-option.

Motivation

The custom Jest preset of the Node/React framework my team and I are maintaining relies on the fact, that the transpiled Typescript, ts-jest passes on to Babel, still contains ES Modules. Otherwise the custom Babel plugin that is part of the preset stops working.

So we rather need the useESM-option to override the supportsStaticESM-option. Then ESM can be enabled implicitly by providing the respective environment to Jest. Or explicitly by setting useESM to true. And vice versa, ESM could be disabled while the environment indicates the opposite to Jest — whoever might need this.

What do you think?

@herschel666 herschel666 added the 🚀 Feature Request new suggested feature label Jun 1, 2021
@ahnpnl
Copy link
Collaborator

ahnpnl commented Jun 1, 2021

what exactly is the problem?

We don't change the way how module resolution works in the scope of TypeScript compiler. The change to support Jest ESM is: supportStaticESM: true and useESM: true, ts-jest will produce ESM codes.
However, there can be the case supportStaticESM: false (this is decided by Jest) and useESM: true which ts-jest will fallback to produce CJS codes, this is the recommendation from Jest team.

TypeScript module resolution has nothing to do with emitted codes. The emitted codes are decided by module value in tsconfig.

Would you be more clear about the term resolution here?

@herschel666
Copy link
Author

@ahnpnl Thanks for the fast reply! 🙏

However, there can be the case supportStaticESM: false (this is decided by Jest) and useESM: true which ts-jest will fallback to produce CJS codes, this is the recommendation from Jest team.

That's exactly the issue: Jest decides that supportStaticESM is false and suddenly, by upgrading Jest and ts-jest to version 27, the code our Babel transformer receives is no longer ESM code but CJS code. The tsconfig.json is ignored. And our custom Babel plugin stops working, because it doesn't find the imported function it is support to alter anymore.

Would you be more clear about the term resolution here?

Sorry, that's a mistake. The module resolution is not the issue here, but the module type of the code that ts-jest's TS compilation emits.

@ahnpnl
Copy link
Collaborator

ahnpnl commented Jun 1, 2021

By default, if useESM is false, so emitted codes should always be CJS. If that is not the case, it is clearly a bug. If you see that, please report a bug.

When useESM is true, ts-jest will check:

  • supportStaticESM: true: ts-jest will use module from tsconfig to emit ESM codes. If module is not available in tsconfig or its value is not ES2015, ES2020 and ESNext, the default value ESNext will be used.
  • supportStaticESM: false: ts-jest will use hardcoded module: CommonJS to emit CJS codes.

That is the implementation which cannot be changed because that is the recommended/must-have implementation required by Jest team.

If the current implementation causes wrong emitted codes, please provide us a repo so that we can check and fix.

@herschel666
Copy link
Author

ts-jest is working as expected. But I'm struggling to understand why hardcoding module to CommonJS is a must-have for Jest when supportStaticESM is detected to be false.

What I'm asking for is a way to tell Jest that I don't care about the value of supportStaticESM, but that I set useESM to true, because that's what I want/need it to be. What would be the issue in this case, when I'm taking care of transpiling the code to CJS myself via Babel?

@ahnpnl
Copy link
Collaborator

ahnpnl commented Jun 1, 2021

ts-jest is working as expected. But I'm struggling to understand why hardcoding module to CommonJS is a must-have for Jest when supportStaticESM is detected to be false.

This looks not right. You shouldn’t need to hardcode it because ts-jest will handle it automatically. For Babel, the module value doesn’t impact how Babel works.

What I'm asking for is a way to tell Jest that I don't care about the value of supportStaticESM, but that I set useESM to true, because that's what I want/need it to be. What would be the issue in this case, when I'm taking care of transpiling the code to CJS myself via Babel?

ts-jest is a Jest transformer. Transformer is a function which accepts inputs (inputs here come from Jest runtime) and produces transpiled codes.

At the moment, when using ts-jest with Babel, ts-jest will invoke babel-jest, see

result = babelJest.process(result, filePath, { ...transformOptions, instrument: false })
with whatever transform options that ts-jest receives from Jest runtime, then the rest is up to babel-jest to do the job. Transform options here include supportStaticESM.

By default, when running Jest with Node ESM flag, Jest will mark js, mjs to be treated as ESM files via https://jestjs.io/docs/next/configuration#extensionstotreatasesm-arraystring. The Jest runtime will check this option and perform some logic to set value for supportStaticEsm. ts-jest adds additional ts in the ESM presets.

I’m not sure what you ask can be done, I’m not entirely clear yet what you want to achieve. Do you have some pseudo examples?

@herschel666
Copy link
Author

This looks not right. You shouldn’t need to hardcode it because ts-jest will handle it automatically.

I know & that's the issue I'm talking about. ts-jest produces CJS code when Jest "tells" it that ESM is not supported natively. But I don't want ts-jest to take that decision from me. I need ts-jest to produce ESM code in its TS compilation — even in environments that do not support ESM natively. I need ts-jest to always produce ESM code, whatever Jest "says"! I have a Babel plugin in my Jest setup that expects to receive ESM code from the ts-jest-internal TS compilation. And Babel also takes care of producing the CJS code for the Jest runner. So there's no need for ts-jest for being smart here.

It does not matter whether Jest thinks the environment is capable of handling ESM code or not — I need ts-jest to produce ESM code in its TS compilation. And that's currently not easily possible, because ts-jest does not respect user configuration in that matter.

@ahnpnl
Copy link
Collaborator

ahnpnl commented Jun 2, 2021

I think the best way to do this is: if user uses Babel, ts-jest can just emit ESM always. What do you think?

@herschel666
Copy link
Author

I think the best way to do this is: if user uses Babel, ts-jest can just emit ESM always. What do you think?

Yes, that would be really helpful! 👍

@ahnpnl ahnpnl changed the title Allow ESM resolution independent of Jest's supportsStaticESM-option ESM mode: let TypeScript emit ESM codes always when using with Babel Jun 2, 2021
@ahnpnl
Copy link
Collaborator

ahnpnl commented Jun 7, 2021

27.0.3 should have the behavior you need

@herschel666
Copy link
Author

@ahnpnl Works perfectly fine. Thanks!! 🙏

Vylpes pushed a commit to Vylpes/Droplet that referenced this issue Sep 14, 2023
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [ts-jest](https://kulshekhar.github.io/ts-jest) ([source](https://github.com/kulshekhar/ts-jest)) | devDependencies | major | [`^26.5.6` -> `^29.0.0`](https://renovatebot.com/diffs/npm/ts-jest/26.5.6/29.1.0) |

---

### Release Notes

<details>
<summary>kulshekhar/ts-jest</summary>

### [`v29.1.0`](https://github.com/kulshekhar/ts-jest/blob/HEAD/CHANGELOG.md#&#8203;2910-httpsgithubcomkulshekharts-jestcomparev2905v2910-2023-03-26)

[Compare Source](https://github.com/kulshekhar/ts-jest/compare/v29.0.5...v29.1.0)

##### Features

-   Support TypeScript 5.x ([#&#8203;4064](https://github.com/kulshekhar/ts-jest/issues/4064)) ([db98cc9](https://github.com/kulshekhar/ts-jest/commit/87f27821db99be411288b50a4f9baa7bedb98cc9)), closes [#&#8203;4048](https://github.com/kulshekhar/ts-jest/issues/4048)

#### [29.0.5](https://github.com/kulshekhar/ts-jest/compare/v29.0.4...v29.0.5) (2023-01-13)

##### Reverts

-   Revert "fix(transformer): don't use cache when `tsJestConfig` is different ([#&#8203;3966](https://github.com/kulshekhar/ts-jest/issues/3966))" ([185eb18](https://github.com/kulshekhar/ts-jest/commit/185eb189d7076c717a107066817d2d6959a8fe39)), closes [#&#8203;3966](https://github.com/kulshekhar/ts-jest/issues/3966)

#### [29.0.4](https://github.com/kulshekhar/ts-jest/compare/v29.0.3...v29.0.4) (2023-01-10)

##### Bug Fixes

-   **transformer:** don't use cache when `tsJestConfig` is different ([#&#8203;3966](https://github.com/kulshekhar/ts-jest/issues/3966)) ([a445638](https://github.com/kulshekhar/ts-jest/commit/a445638ca631911e8ab1a896ffdfcd21506ce71a))
-   bump `json5` to `2.2.3` ([#&#8203;3976](https://github.com/kulshekhar/ts-jest/pull/3976))([b9f7809](https://github.com/kulshekhar/ts-jest/commit/b9f7809948309f92534aeba63f3ffb01cb7dc536))

#### [29.0.3](https://github.com/kulshekhar/ts-jest/compare/v29.0.2...v29.0.3) (2022-09-28)

##### Bug Fixes

-   merge config from `globals` with transformer config correctly ([#&#8203;3842](https://github.com/kulshekhar/ts-jest/issues/3842)) ([9c9fd60](https://github.com/kulshekhar/ts-jest/commit/9c9fd6097aea36a6e8b06b0e8841df22896f9121)), closes [#&#8203;3841](https://github.com/kulshekhar/ts-jest/issues/3841)
-   **presets:** allow merging transform config when using presets ([#&#8203;3833](https://github.com/kulshekhar/ts-jest/issues/3833)) ([afc6a94](https://github.com/kulshekhar/ts-jest/commit/afc6a948b17c2dc22be51b1a9475a0f6ecbbc372))

##### Features

-   add `useESM` option to `pathsToModuleNameMapper` options ([#&#8203;3792](https://github.com/kulshekhar/ts-jest/issues/3792)) ([eabe906](https://github.com/kulshekhar/ts-jest/commit/eabe906e1dd6b132a7b0d05ffc13172cd8a6b73b))

#### [29.0.2](https://github.com/kulshekhar/ts-jest/compare/v29.0.1...v29.0.2) (2022-09-23)

##### Bug Fixes

-   mark `ts-jest` as optional in `ConfigGlobals` ([#&#8203;3816](https://github.com/kulshekhar/ts-jest/issues/3816)) ([cbb88bb](https://github.com/kulshekhar/ts-jest/commit/cbb88bba34dbb852d8f4013be6e020769feb306d)), closes [#&#8203;3815](https://github.com/kulshekhar/ts-jest/issues/3815)
-   use correct typings for `config:init` command ([#&#8203;3825](https://github.com/kulshekhar/ts-jest/issues/3825)) ([21b94db](https://github.com/kulshekhar/ts-jest/commit/21b94dbca25b762f79e63b92dea12d830f444570))

#### [29.0.2](https://github.com/kulshekhar/ts-jest/compare/v29.0.1...v29.0.2) (2022-09-22)

##### Bug Fixes

-   mark `ts-jest` as optional in `ConfigGlobals` ([#&#8203;3816](https://github.com/kulshekhar/ts-jest/issues/3816)) ([cbb88bb](https://github.com/kulshekhar/ts-jest/commit/cbb88bba34dbb852d8f4013be6e020769feb306d)), closes [#&#8203;3815](https://github.com/kulshekhar/ts-jest/issues/3815)

#### [29.0.1](https://github.com/kulshekhar/ts-jest/compare/v29.0.0...v29.0.1) (2022-09-13)

##### Bug Fixes

-   **legacy:** include existing globals config in cached config ([#&#8203;3803](https://github.com/kulshekhar/ts-jest/issues/3803)) ([e79be47](https://github.com/kulshekhar/ts-jest/commit/e79be47d2b81a677d0dd39d84328a38ca0f0ffc6))

##### Features

-   add typings for `ts-jest` options via `transform` config ([#&#8203;3805](https://github.com/kulshekhar/ts-jest/issues/3805)) ([664b0f2](https://github.com/kulshekhar/ts-jest/commit/664b0f2b446a36dd7661f4840ca3dd7722f1f6ff))

### [`v29.0.5`](https://github.com/kulshekhar/ts-jest/blob/HEAD/CHANGELOG.md#&#8203;2905-httpsgithubcomkulshekharts-jestcomparev2904v2905-2023-01-13)

[Compare Source](https://github.com/kulshekhar/ts-jest/compare/v29.0.4...v29.0.5)

##### Reverts

-   Revert "fix(transformer): don't use cache when `tsJestConfig` is different ([#&#8203;3966](https://github.com/kulshekhar/ts-jest/issues/3966))" ([185eb18](https://github.com/kulshekhar/ts-jest/commit/185eb189d7076c717a107066817d2d6959a8fe39)), closes [#&#8203;3966](https://github.com/kulshekhar/ts-jest/issues/3966)

### [`v29.0.4`](https://github.com/kulshekhar/ts-jest/blob/HEAD/CHANGELOG.md#&#8203;2904-httpsgithubcomkulshekharts-jestcomparev2903v2904-2023-01-10)

[Compare Source](https://github.com/kulshekhar/ts-jest/compare/v29.0.3...v29.0.4)

##### Bug Fixes

-   **transformer:** don't use cache when `tsJestConfig` is different ([#&#8203;3966](https://github.com/kulshekhar/ts-jest/issues/3966)) ([a445638](https://github.com/kulshekhar/ts-jest/commit/a445638ca631911e8ab1a896ffdfcd21506ce71a))
-   bump `json5` to `2.2.3` ([#&#8203;3976](https://github.com/kulshekhar/ts-jest/pull/3976))([b9f7809](https://github.com/kulshekhar/ts-jest/commit/b9f7809948309f92534aeba63f3ffb01cb7dc536))

### [`v29.0.3`](https://github.com/kulshekhar/ts-jest/blob/HEAD/CHANGELOG.md#&#8203;2903-httpsgithubcomkulshekharts-jestcomparev2902v2903-2022-09-28)

[Compare Source](https://github.com/kulshekhar/ts-jest/compare/v29.0.2...v29.0.3)

##### Bug Fixes

-   merge config from `globals` with transformer config correctly ([#&#8203;3842](https://github.com/kulshekhar/ts-jest/issues/3842)) ([9c9fd60](https://github.com/kulshekhar/ts-jest/commit/9c9fd6097aea36a6e8b06b0e8841df22896f9121)), closes [#&#8203;3841](https://github.com/kulshekhar/ts-jest/issues/3841)
-   **presets:** allow merging transform config when using presets ([#&#8203;3833](https://github.com/kulshekhar/ts-jest/issues/3833)) ([afc6a94](https://github.com/kulshekhar/ts-jest/commit/afc6a948b17c2dc22be51b1a9475a0f6ecbbc372))

##### Features

-   add `useESM` option to `pathsToModuleNameMapper` options ([#&#8203;3792](https://github.com/kulshekhar/ts-jest/issues/3792)) ([eabe906](https://github.com/kulshekhar/ts-jest/commit/eabe906e1dd6b132a7b0d05ffc13172cd8a6b73b))

### [`v29.0.2`](https://github.com/kulshekhar/ts-jest/blob/HEAD/CHANGELOG.md#&#8203;2902-httpsgithubcomkulshekharts-jestcomparev2901v2902-2022-09-23)

[Compare Source](https://github.com/kulshekhar/ts-jest/compare/v29.0.1...v29.0.2)

##### Bug Fixes

-   mark `ts-jest` as optional in `ConfigGlobals` ([#&#8203;3816](https://github.com/kulshekhar/ts-jest/issues/3816)) ([cbb88bb](https://github.com/kulshekhar/ts-jest/commit/cbb88bba34dbb852d8f4013be6e020769feb306d)), closes [#&#8203;3815](https://github.com/kulshekhar/ts-jest/issues/3815)
-   use correct typings for `config:init` command ([#&#8203;3825](https://github.com/kulshekhar/ts-jest/issues/3825)) ([21b94db](https://github.com/kulshekhar/ts-jest/commit/21b94dbca25b762f79e63b92dea12d830f444570))

### [`v29.0.1`](https://github.com/kulshekhar/ts-jest/blob/HEAD/CHANGELOG.md#&#8203;2901-httpsgithubcomkulshekharts-jestcomparev2900v2901-2022-09-13)

[Compare Source](https://github.com/kulshekhar/ts-jest/compare/v29.0.0...v29.0.1)

##### Bug Fixes

-   **legacy:** include existing globals config in cached config ([#&#8203;3803](https://github.com/kulshekhar/ts-jest/issues/3803)) ([e79be47](https://github.com/kulshekhar/ts-jest/commit/e79be47d2b81a677d0dd39d84328a38ca0f0ffc6))

##### Features

-   add typings for `ts-jest` options via `transform` config ([#&#8203;3805](https://github.com/kulshekhar/ts-jest/issues/3805)) ([664b0f2](https://github.com/kulshekhar/ts-jest/commit/664b0f2b446a36dd7661f4840ca3dd7722f1f6ff))

### [`v29.0.0`](https://github.com/kulshekhar/ts-jest/blob/HEAD/CHANGELOG.md#&#8203;2900-httpsgithubcomkulshekharts-jestcomparev2900-next1v2900-2022-09-08)

[Compare Source](https://github.com/kulshekhar/ts-jest/compare/v28.0.8...v29.0.0)

##### Features

-   drop Node 12 and Node 17 support ([#&#8203;3787](https://github.com/kulshekhar/ts-jest/issues/3787)) ([0f1de16](https://github.com/kulshekhar/ts-jest/commit/0f1de16608dcc7a8ab00bf7fd6a01ebcec6a210a))
-   migrate globals config to transformer config ([#&#8203;3780](https://github.com/kulshekhar/ts-jest/issues/3780)) ([31e5843](https://github.com/kulshekhar/ts-jest/commit/31e584355434c4fc96022f9e8b41f04c11d24343))
-   support Jest 29 ([#&#8203;3767](https://github.com/kulshekhar/ts-jest/issues/3767)) ([94b553b](https://github.com/kulshekhar/ts-jest/commit/94b553ba085c52db60f7a7078e3a74d9a02121b1))

##### DEPRECATIONS

-   Define `ts-jest` config under `globals` is now deprecated. Please define the config via transformer config instead.

##### BREAKING CHANGES

-   Only Node 14, 16 and 18 are supported
-   **Jest 29** is required.

### [`v28.0.8`](https://github.com/kulshekhar/ts-jest/blob/HEAD/CHANGELOG.md#&#8203;2808-httpsgithubcomkulshekharts-jestcomparev2807v2808-2022-08-14)

[Compare Source](https://github.com/kulshekhar/ts-jest/compare/v28.0.7...v28.0.8)

##### Bug Fixes

-   allow `.mts` to be processed ([#&#8203;3713](https://github.com/kulshekhar/ts-jest/issues/3713)) ([effae71](https://github.com/kulshekhar/ts-jest/commit/effae717369860e16cb0ccbf24027651493b9bf1)), closes [#&#8203;3702](https://github.com/kulshekhar/ts-jest/issues/3702)

### [`v28.0.7`](https://github.com/kulshekhar/ts-jest/blob/HEAD/CHANGELOG.md#&#8203;2807-httpsgithubcomkulshekharts-jestcomparev2806v2807-2022-07-15)

[Compare Source](https://github.com/kulshekhar/ts-jest/compare/v28.0.6...v28.0.7)

##### Bug Fixes

-   update `@jest/types` to be an optional peer dependency ([#&#8203;3690](https://github.com/kulshekhar/ts-jest/issues/3690)) ([8a8c3fa](https://github.com/kulshekhar/ts-jest/commit/8a8c3fafecffd19380171c661e94246024cae2ff)), closes [#&#8203;3689](https://github.com/kulshekhar/ts-jest/issues/3689)

### [`v28.0.6`](https://github.com/kulshekhar/ts-jest/blob/HEAD/CHANGELOG.md#&#8203;2806-httpsgithubcomkulshekharts-jestcomparev2805v2806-2022-07-13)

[Compare Source](https://github.com/kulshekhar/ts-jest/compare/v28.0.5...v28.0.6)

##### Bug Fixes

-   **config:** don't show diagnostics warning with `diagnostics: false` ([#&#8203;3647](https://github.com/kulshekhar/ts-jest/issues/3647)) ([9a9bc02](https://github.com/kulshekhar/ts-jest/commit/9a9bc02935968fb5eb9fd3614a1f7cce019b80d8)), closes [#&#8203;3638](https://github.com/kulshekhar/ts-jest/issues/3638)
-   **legacy:** add `useCaseSensitiveFileNames` wherever needed ([#&#8203;3683](https://github.com/kulshekhar/ts-jest/issues/3683)) ([c40bc34](https://github.com/kulshekhar/ts-jest/commit/c40bc34625d63cccc0db7296e616af27868fe1fe)), closes [#&#8203;3665](https://github.com/kulshekhar/ts-jest/issues/3665)
-   set `@jest/types` as peer dependency ([#&#8203;3633](https://github.com/kulshekhar/ts-jest/issues/3633)) ([24567e1](https://github.com/kulshekhar/ts-jest/commit/24567e13d2780ad8a11c7ff35f9151ec53f8c211))

### [`v28.0.5`](https://github.com/kulshekhar/ts-jest/blob/HEAD/CHANGELOG.md#&#8203;2805-httpsgithubcomkulshekharts-jestcomparev2804v2805-2022-06-11)

[Compare Source](https://github.com/kulshekhar/ts-jest/compare/v28.0.4...v28.0.5)

##### Bug Fixes

-   **legacy:** throw type check error in ESM mode with `reject` ([#&#8203;3618](https://github.com/kulshekhar/ts-jest/issues/3618)) ([7dd01ff](https://github.com/kulshekhar/ts-jest/commit/7dd01ffe0c7ad3add87b11227964544f2586355a)), closes [#&#8203;3507](https://github.com/kulshekhar/ts-jest/issues/3507)

### [`v28.0.4`](https://github.com/kulshekhar/ts-jest/blob/HEAD/CHANGELOG.md#&#8203;2804-httpsgithubcomkulshekharts-jestcomparev2803v2804-2022-06-02)

[Compare Source](https://github.com/kulshekhar/ts-jest/compare/v28.0.3...v28.0.4)

##### Bug Fixes

-   remove `@types/jest` from peer deps ([#&#8203;3592](https://github.com/kulshekhar/ts-jest/issues/3592)) ([b66b656](https://github.com/kulshekhar/ts-jest/commit/b66b656e0f29eea9234a4d1e883c6d249437f03c))

### [`v28.0.3`](https://github.com/kulshekhar/ts-jest/blob/HEAD/CHANGELOG.md#&#8203;2803-httpsgithubcomkulshekharts-jestcomparev2802v2803-2022-05-23)

[Compare Source](https://github.com/kulshekhar/ts-jest/compare/v28.0.2...v28.0.3)

##### Bug Fixes

-   **security:** update version of `json5` ([#&#8203;3528](https://github.com/kulshekhar/ts-jest/issues/3528)) ([b31f5ba](https://github.com/kulshekhar/ts-jest/commit/b31f5bab142466fd8b6157ec03eff7316584e51d))

### [`v28.0.2`](https://github.com/kulshekhar/ts-jest/blob/HEAD/CHANGELOG.md#&#8203;2802-httpsgithubcomkulshekharts-jestcomparev2801v2802-2022-05-07)

[Compare Source](https://github.com/kulshekhar/ts-jest/compare/v28.0.1...v28.0.2)

##### Bug Fixes

-   **transformers:** use `Array.sort` in hoisting transformer ([#&#8203;3498](https://github.com/kulshekhar/ts-jest/issues/3498)) ([e400a6e](https://github.com/kulshekhar/ts-jest/commit/e400a6ec0e4706f606ae9b1e2897b0bb1cff6343)), closes [#&#8203;3476](https://github.com/kulshekhar/ts-jest/issues/3476)

### [`v28.0.1`](https://github.com/kulshekhar/ts-jest/blob/HEAD/CHANGELOG.md#&#8203;2801-httpsgithubcomkulshekharts-jestcomparev2800v2801-2022-05-03)

[Compare Source](https://github.com/kulshekhar/ts-jest/compare/v28.0.0...v28.0.1)

##### Bug Fixes

-   lower the required node version to ^16.10 ([#&#8203;3495](https://github.com/kulshekhar/ts-jest/issues/3495)) ([3a4e48a](https://github.com/kulshekhar/ts-jest/commit/3a4e48afffa56f76efb98f48ad3e07a92731748e)), closes [#&#8203;3494](https://github.com/kulshekhar/ts-jest/issues/3494)

### [`v28.0.0`](https://github.com/kulshekhar/ts-jest/blob/HEAD/CHANGELOG.md#&#8203;2800-httpsgithubcomkulshekharts-jestcomparev2800-next3v2800-2022-05-02)

[Compare Source](https://github.com/kulshekhar/ts-jest/compare/v27.1.5...v28.0.0)

##### Bug Fixes

-   **legacy** invoke Babel `processAsync` for `babel-jest` in ESM mode instead of `process` ([#&#8203;3430](https://github.com/kulshekhar/ts-jest/issues/3430)) ([0d7356c](https://github.com/kulshekhar/ts-jest/commit/0d7356cd767a924e5b57e3a93679eef4ca8fae51))

##### Features

-   **presets:** add presets for legacy mode ([#&#8203;3465](https://github.com/kulshekhar/ts-jest/issues/3465)) ([543b4ad](https://github.com/kulshekhar/ts-jest/commit/543b4ad729d20fbd46a2de5cd4660dc50b94ebe7))
-   mark `ConfigSet` as legacy ([#&#8203;3456](https://github.com/kulshekhar/ts-jest/issues/3456)) ([a986729](https://github.com/kulshekhar/ts-jest/commit/a98672977a679d1ed882605a3e71ed405432ffdc))
-   mark `TsCompiler` and `TsJestCompiler` as legacy ([#&#8203;3457](https://github.com/kulshekhar/ts-jest/issues/3457)) ([0f2fe30](https://github.com/kulshekhar/ts-jest/commit/0f2fe306762d8549bd29737becd4aed14a650427))
-   remove `path-mapping` AST transformer ([#&#8203;3455](https://github.com/kulshekhar/ts-jest/issues/3455)) ([f566869](https://github.com/kulshekhar/ts-jest/commit/f5668698f8fab78b3008d936aa5001f134f530e2))
-   set Jest peer dependencies to v28 ([#&#8203;3454](https://github.com/kulshekhar/ts-jest/issues/3454)) ([1e880ff](https://github.com/kulshekhar/ts-jest/commit/1e880fffe82bca231d1d23f6508f4ab4bc31e03e))
-   **core:** drop support for Node.js 10 ([#&#8203;3332](https://github.com/kulshekhar/ts-jest/issues/3332)) ([7a9aa61](https://github.com/kulshekhar/ts-jest/commit/7a9aa615ea0be881105676a17d5bd655afdc27f5))
-   **core:** remove `mocked` testing util ([#&#8203;3333](https://github.com/kulshekhar/ts-jest/issues/3333)) ([2d9017d](https://github.com/kulshekhar/ts-jest/commit/2d9017ddfea39f45aa991876b314d1dbe4a36aad))
-   **core:** remove `ts-jest/utils` sub path export ([#&#8203;3334](https://github.com/kulshekhar/ts-jest/issues/3334)) ([9f253d3](https://github.com/kulshekhar/ts-jest/commit/9f253d31dfcefa35ae00049d0d2dc4a3fe1b2f34))
-   mark `TsJestTransformer` as legacy ([#&#8203;3451](https://github.com/kulshekhar/ts-jest/issues/3451)) ([b090179](https://github.com/kulshekhar/ts-jest/commit/b0901799adc519959a954dba5e7b8fc8b97a9665))

##### BREAKING CHANGES

-   `path-mapping` AST transformer is no longer shipped in `ts-jest` v28. Please use an alternative one like https://github.com/LeDDGroup/typescript-transform-paths instead.
-   Any imports `ts-jest/dist/compiler/ts-compiler` should change to `ts-jest/dist/legacy/compiler/ts-compiler`
-   Any imports `ts-jest/dist/compiler/ts-jest-compiler` should change to `ts-jest/dist/legacy/compiler/ts-jest-compiler`
-   Any imports `ts-jest/dist/config/config-set` should change to `ts-jest/dist/legacy/config/config-set`
-   Minimum support `TypeScript` version is now **4.3** since Jest 28 requires it.
-   **Jest 28** is required.
-   **core:** Any imports `ts-jest/utils` should be replaced with `ts-jest`.
-   **core:** Starting from Jest 27.4, `mocked` has been integrated into Jest repo.
-   **core:** Support for Node.js v10 has been removed as Jest drops support for it.

#### [27.1.5](https://github.com/kulshekhar/ts-jest/compare/v27.1.3...v27.1.4) (2022-05-17)

##### Bug Fixes

-   **transformers** use `Array.sort` in hoisting transformer ([#&#8203;3498](https://github.com/kulshekhar/ts-jest/pull/3498)) ([e400a6e](https://github.com/kulshekhar/ts-jest/commit/e400a6ec0e4706f606ae9b1e2897b0bb1cff6343)), fixes [#&#8203;3476](https://github.com/kulshekhar/ts-jest/issues/3476)

#### [27.1.4](https://github.com/kulshekhar/ts-jest/compare/v27.1.3...v27.1.4) (2022-03-24)

##### Bug Fixes

-   **compiler:** revert [#&#8203;3194](https://github.com/kulshekhar/ts-jest/issues/3194) ([#&#8203;3362](https://github.com/kulshekhar/ts-jest/issues/3362)) ([2b7dffe](https://github.com/kulshekhar/ts-jest/commit/2b7dffeac940f779922c43cefba3f741a3911b49)), closes [#&#8203;3272](https://github.com/kulshekhar/ts-jest/issues/3272)
-   remove `esbuild` from peer dependency ([#&#8203;3360](https://github.com/kulshekhar/ts-jest/issues/3360)) ([8c8c1ca](https://github.com/kulshekhar/ts-jest/commit/8c8c1ca615b1edeedc9f4282557c28e82acee543)), closes [#&#8203;3346](https://github.com/kulshekhar/ts-jest/issues/3346)
-   support Babel config file with `.cjs` extension ([#&#8203;3361](https://github.com/kulshekhar/ts-jest/issues/3361)) ([5e5ac4a](https://github.com/kulshekhar/ts-jest/commit/5e5ac4ac286bdcce157d0bdc31f3a57202fdbdfe)), closes [#&#8203;3335](https://github.com/kulshekhar/ts-jest/issues/3335)

#### [27.1.3](https://github.com/kulshekhar/ts-jest/compare/v27.1.2...v27.1.3) (2022-01-14)

##### Bug Fixes

-   **compiler:** update memory cache for compiler using received file content ([#&#8203;3194](https://github.com/kulshekhar/ts-jest/issues/3194)) ([e4d9541](https://github.com/kulshekhar/ts-jest/commit/e4d9541f262ca14cb25563c757c0f2345dbf5c51))

#### [27.1.2](https://github.com/kulshekhar/ts-jest/compare/v27.1.1...v27.1.2) (2021-12-15)

##### Bug Fixes

-   stimulate `esbuild` type to avoid importing `esbuild` directly ([#&#8203;3147](https://github.com/kulshekhar/ts-jest/issues/3147)) ([9ace0a9](https://github.com/kulshekhar/ts-jest/commit/9ace0a9991da8bcb0f04a2e603f7601d6fb630e7))

#### [27.1.1](https://github.com/kulshekhar/ts-jest/compare/v27.1.0...v27.1.1) (2021-12-07)

##### Bug Fixes

-   bring back `afterProcess` hook ([#&#8203;3132](https://github.com/kulshekhar/ts-jest/issues/3132)) ([2b6b86e](https://github.com/kulshekhar/ts-jest/commit/2b6b86e01dcd3d9d9906f24fe3db5cadb799146a))
-   make `esbuild` as optional peer dependency ([#&#8203;3129](https://github.com/kulshekhar/ts-jest/pull/3129)) ([20258de](https://github.com/kulshekhar/ts-jest/commit/20258de54c9c10f8d2495bda174f9865a3cebc91))

### [`v27.1.5`](https://github.com/kulshekhar/ts-jest/blob/HEAD/CHANGELOG.md#&#8203;2715-httpsgithubcomkulshekharts-jestcomparev2713v2714-2022-05-17)

[Compare Source](https://github.com/kulshekhar/ts-jest/compare/v27.1.4...v27.1.5)

##### Bug Fixes

-   **transformers** use `Array.sort` in hoisting transformer ([#&#8203;3498](https://github.com/kulshekhar/ts-jest/pull/3498)) ([e400a6e](https://github.com/kulshekhar/ts-jest/commit/e400a6ec0e4706f606ae9b1e2897b0bb1cff6343)), fixes [#&#8203;3476](https://github.com/kulshekhar/ts-jest/issues/3476)

### [`v27.1.4`](https://github.com/kulshekhar/ts-jest/blob/HEAD/CHANGELOG.md#&#8203;2714-httpsgithubcomkulshekharts-jestcomparev2713v2714-2022-03-24)

[Compare Source](https://github.com/kulshekhar/ts-jest/compare/v27.1.3...v27.1.4)

##### Bug Fixes

-   **compiler:** revert [#&#8203;3194](https://github.com/kulshekhar/ts-jest/issues/3194) ([#&#8203;3362](https://github.com/kulshekhar/ts-jest/issues/3362)) ([2b7dffe](https://github.com/kulshekhar/ts-jest/commit/2b7dffeac940f779922c43cefba3f741a3911b49)), closes [#&#8203;3272](https://github.com/kulshekhar/ts-jest/issues/3272)
-   remove `esbuild` from peer dependency ([#&#8203;3360](https://github.com/kulshekhar/ts-jest/issues/3360)) ([8c8c1ca](https://github.com/kulshekhar/ts-jest/commit/8c8c1ca615b1edeedc9f4282557c28e82acee543)), closes [#&#8203;3346](https://github.com/kulshekhar/ts-jest/issues/3346)
-   support Babel config file with `.cjs` extension ([#&#8203;3361](https://github.com/kulshekhar/ts-jest/issues/3361)) ([5e5ac4a](https://github.com/kulshekhar/ts-jest/commit/5e5ac4ac286bdcce157d0bdc31f3a57202fdbdfe)), closes [#&#8203;3335](https://github.com/kulshekhar/ts-jest/issues/3335)

### [`v27.1.3`](https://github.com/kulshekhar/ts-jest/blob/HEAD/CHANGELOG.md#&#8203;2713-httpsgithubcomkulshekharts-jestcomparev2712v2713-2022-01-14)

[Compare Source](https://github.com/kulshekhar/ts-jest/compare/v27.1.2...v27.1.3)

##### Bug Fixes

-   **compiler:** update memory cache for compiler using received file content ([#&#8203;3194](https://github.com/kulshekhar/ts-jest/issues/3194)) ([e4d9541](https://github.com/kulshekhar/ts-jest/commit/e4d9541f262ca14cb25563c757c0f2345dbf5c51))

### [`v27.1.2`](https://github.com/kulshekhar/ts-jest/blob/HEAD/CHANGELOG.md#&#8203;2712-httpsgithubcomkulshekharts-jestcomparev2711v2712-2021-12-15)

[Compare Source](https://github.com/kulshekhar/ts-jest/compare/v27.1.1...v27.1.2)

##### Bug Fixes

-   stimulate `esbuild` type to avoid importing `esbuild` directly ([#&#8203;3147](https://github.com/kulshekhar/ts-jest/issues/3147)) ([9ace0a9](https://github.com/kulshekhar/ts-jest/commit/9ace0a9991da8bcb0f04a2e603f7601d6fb630e7))

### [`v27.1.1`](https://github.com/kulshekhar/ts-jest/blob/HEAD/CHANGELOG.md#&#8203;2711-httpsgithubcomkulshekharts-jestcomparev2710v2711-2021-12-07)

[Compare Source](https://github.com/kulshekhar/ts-jest/compare/v27.1.0...v27.1.1)

##### Bug Fixes

-   bring back `afterProcess` hook ([#&#8203;3132](https://github.com/kulshekhar/ts-jest/issues/3132)) ([2b6b86e](https://github.com/kulshekhar/ts-jest/commit/2b6b86e01dcd3d9d9906f24fe3db5cadb799146a))
-   make `esbuild` as optional peer dependency ([#&#8203;3129](https://github.com/kulshekhar/ts-jest/pull/3129)) ([20258de](https://github.com/kulshekhar/ts-jest/commit/20258de54c9c10f8d2495bda174f9865a3cebc91))

### [`v27.1.0`](https://github.com/kulshekhar/ts-jest/blob/HEAD/CHANGELOG.md#&#8203;2710-httpsgithubcomkulshekharts-jestcomparev2707v2710-2021-11-30)

[Compare Source](https://github.com/kulshekhar/ts-jest/compare/v27.0.7...v27.1.0)

##### Features

-   allow subclasses to extend `processAsync` and `getCacheKeyAsync` ([#&#8203;3047](https://github.com/kulshekhar/ts-jest/issues/3047)) ([571a880](https://github.com/kulshekhar/ts-jest/commit/571a880007642c9dcbcd7bf109c5392e7eb78cc4))
-   **config:** support custom AST transformers written in TypeScript ([#&#8203;3063](https://github.com/kulshekhar/ts-jest/issues/3063)) ([340a305](https://github.com/kulshekhar/ts-jest/commit/340a30573e5ff92df77c94af51c371ce4bf956e7)), closes [#&#8203;2831](https://github.com/kulshekhar/ts-jest/issues/2831)
-   export `ts-jest` public apis from `index.js` ([#&#8203;3080](https://github.com/kulshekhar/ts-jest/issues/3080)) ([53175dd](https://github.com/kulshekhar/ts-jest/commit/53175dd04218bf22ead464e30aa01b258c87e7af)), closes [#&#8203;3045](https://github.com/kulshekhar/ts-jest/issues/3045)

##### Code Refactoring

-   **utils:** deprecate `mocked` util function ([#&#8203;3102](https://github.com/kulshekhar/ts-jest/issues/3102)) ([55e69f1](https://github.com/kulshekhar/ts-jest/commit/55e69f12f65d678962c3087fca7673992f5f1b26))
-   define clear type for `compiler` option ([#&#8203;3087](https://github.com/kulshekhar/ts-jest/issues/3087)) ([cc42daf](https://github.com/kulshekhar/ts-jest/commit/cc42daf795585887664be59956d2c52244237bda))
-   **transformers**: deprecate `path-mapping` AST transformer ([#&#8203;3088](https://github.com/kulshekhar/ts-jest/issues/3088)) ([d8f6b96](https://github.com/kulshekhar/ts-jest/commit/d8f6b9624ee76a164aa7003720cd3f83fc6c4865))
-   **transformers**: use ts `factory` API for `hoisting` AST transformer ([#&#8203;3058](https://github.com/kulshekhar/ts-jest/issues/3058)) ([a72f51d](https://github.com/kulshekhar/ts-jest/commit/a72f51d9b7c4ea2866e486c0aac4f4706c3ed542))

#### DEPRECATIONS

-   **transformers**: `path-mapping` AST transformer is deprecated and will be removed in **v28.0.0**. One should use an alternative one like https://github.com/LeDDGroup/typescript-transform-paths instead.
-   **utils**: `mocked` function is deprecated and will be removed in **v28.0.0**. The function has been integrated into `jest-mock` package as a part of Jest **27.4.0**, see https://github.com/facebook/jest/pull/12089. One should use the one from Jest instead

#### [27.0.7](https://github.com/kulshekhar/ts-jest/compare/v27.0.6...v27.0.7) (2021-10-16)

##### Bug Fixes

-   correct `lodash` import ([#&#8203;2978](https://github.com/kulshekhar/ts-jest/issues/2978)) ([8b60679](https://github.com/kulshekhar/ts-jest/commit/8b60679574eb60a3c8109ffd389b64b86a167e72)), closes [#&#8203;2977](https://github.com/kulshekhar/ts-jest/issues/2977)

#### [27.0.6](https://github.com/kulshekhar/ts-jest/compare/v27.0.5...v27.0.6) (2021-10-14)

##### Bug Fixes

-   use specific `lodash` package instead of full package `lodash` ([#&#8203;2959](https://github.com/kulshekhar/ts-jest/issues/2959)) ([dc89fe5](https://github.com/kulshekhar/ts-jest/commit/dc89fe55f2b77da76443f827fe3055f07cf4809c)), closes [#&#8203;2954](https://github.com/kulshekhar/ts-jest/issues/2954)

#### [27.0.5](https://github.com/kulshekhar/ts-jest/compare/v27.0.4...v27.0.5) (2021-08-14)

##### Bug Fixes

-   **cli:** add migration `tsConfig` option for `ts-jest` config options ([#&#8203;2794](https://github.com/kulshekhar/ts-jest/issues/2794)) ([781710b](https://github.com/kulshekhar/ts-jest/commit/781710bf6b84853fffbb02543062a726fe1ad9c2)), closes [#&#8203;2764](https://github.com/kulshekhar/ts-jest/issues/2764)
-   **cli:** fix `config:init` genarate invalid type comment ([#&#8203;2773](https://github.com/kulshekhar/ts-jest/issues/2773)) ([ede8a20](https://github.com/kulshekhar/ts-jest/commit/ede8a2061e20b717c0d56e4d81a3cd0ec7db8b1a)), closes [#&#8203;2772](https://github.com/kulshekhar/ts-jest/issues/2772)
-   **config:** handle  `./` in tsconfig `paths` for `pathsToModuleNameMapper`  ([#&#8203;2797](https://github.com/kulshekhar/ts-jest/issues/2797)) ([42ff5e4](https://github.com/kulshekhar/ts-jest/commit/42ff5e469fb5d315b92e85eee105e5a040949c01)), closes [#&#8203;2709](https://github.com/kulshekhar/ts-jest/issues/2709)

##### Code Refactoring

-   use native `Buffer.from` and `mkdird` ([#&#8203;2774](https://github.com/kulshekhar/ts-jest/issues/2774)) ([4869660](https://github.com/kulshekhar/ts-jest/commit/4869660e3917deb063745c5acaf079123d6d2ca8))

#### [27.0.4](https://github.com/kulshekhar/ts-jest/compare/v27.0.3...v27.0.4) (2021-07-21)

##### Bug Fixes

-   add `@types/jest` as optional `peerDependencies` to solve yarn 2 ([#&#8203;2756](https://github.com/kulshekhar/ts-jest/issues/2756)) ([5fbf43e](https://github.com/kulshekhar/ts-jest/commit/5fbf43e64691d5146add1da4690a14b3095c4234))
-   add `babel-jest` as optional `peerDependencies` to solve yarn 2 ([#&#8203;2751](https://github.com/kulshekhar/ts-jest/issues/2751)) ([8bede2e](https://github.com/kulshekhar/ts-jest/commit/8bede2e57546a18999b96871069f1f94a3ecf3c1))
-   **config:** include AST transformer's `name` and `version` into cache key ([#&#8203;2755](https://github.com/kulshekhar/ts-jest/issues/2755)) ([310fb9a](https://github.com/kulshekhar/ts-jest/commit/310fb9a1d7b40a8274d6fb93745e66a6da891a75)), closes [#&#8203;2753](https://github.com/kulshekhar/ts-jest/issues/2753)

##### Features

-   link jest config types on `npx ts-jest:init` ([#&#8203;2742](https://github.com/kulshekhar/ts-jest/issues/2742)) ([f51ba05](https://github.com/kulshekhar/ts-jest/commit/f51ba0507568ba8a5dece48c159d7857a2ed61d6))
-   set env var `TS_JEST` to allow detecting of `ts-jest` ([#&#8203;2717](https://github.com/kulshekhar/ts-jest/issues/2717)) ([56c137a](https://github.com/kulshekhar/ts-jest/commit/56c137a3c1906f49cb0b9e044fa8e233707cbaa4)), closes [#&#8203;2716](https://github.com/kulshekhar/ts-jest/issues/2716)

#### [27.0.3](https://github.com/kulshekhar/ts-jest/compare/v27.0.2...v27.0.3) (2021-06-06)

##### Bug Fixes

-   revert `exports` field to support all node versions ([#&#8203;2658](https://github.com/kulshekhar/ts-jest/issues/2658)) ([132c8ba](https://github.com/kulshekhar/ts-jest/commit/132c8ba85c3e61b7d9ede0dc9730580b79618ab7))

##### Features

-   emit ESM codes if using ESM mode with Babel ([#&#8203;2661](https://github.com/kulshekhar/ts-jest/issues/2661)) ([9b55404](https://github.com/kulshekhar/ts-jest/commit/9b55404a8dfc760238e19786da98a2edf043b9da)), closes [#&#8203;2650](https://github.com/kulshekhar/ts-jest/issues/2650)

#### [27.0.2](https://github.com/kulshekhar/ts-jest/compare/v27.0.1...v27.0.2) (2021-05-30)

##### Bug Fixes

-   **compiler:** add empty string file content to compiler cache ([#&#8203;2633](https://github.com/kulshekhar/ts-jest/issues/2633)) ([0feb556](https://github.com/kulshekhar/ts-jest/commit/0feb5560a588f87d1d989bf521859fba0fda20fe)), closes [#&#8203;2625](https://github.com/kulshekhar/ts-jest/issues/2625)
-   **config:** `exclude` should only exclude files which match glob values ([#&#8203;2637](https://github.com/kulshekhar/ts-jest/issues/2637)) ([c5ce979](https://github.com/kulshekhar/ts-jest/commit/c5ce97902c1b84dc354f270a4f596a6f5f634611)), closes [#&#8203;2634](https://github.com/kulshekhar/ts-jest/issues/2634)

#### [27.0.1](https://github.com/kulshekhar/ts-jest/compare/v27.0.0...v27.0.1) (2021-05-26)

##### Bug Fixes

-   **cli:** keep `testMatch` if old jest config contains it ([#&#8203;2618](https://github.com/kulshekhar/ts-jest/issues/2618)) ([c568f49](https://github.com/kulshekhar/ts-jest/commit/c568f49907fb5559ba1e8c67f1ec5d5eb4af920a)), closes [#&#8203;2616](https://github.com/kulshekhar/ts-jest/issues/2616)
-   **compiler:** make sure `isolatedModules: false` use updated compiler options ([#&#8203;2628](https://github.com/kulshekhar/ts-jest/issues/2628)) ([348e30f](https://github.com/kulshekhar/ts-jest/commit/348e30f426803efc51ecba26ab42619938fcb5af)), closes [#&#8203;2629](https://github.com/kulshekhar/ts-jest/issues/2629)
-   add missing export `presets` ([#&#8203;2624](https://github.com/kulshekhar/ts-jest/issues/2624)) ([0ea025e](https://github.com/kulshekhar/ts-jest/commit/0ea025ebb456d3a31671e31fac0b401c2734a2b1)), closes [#&#8203;2623](https://github.com/kulshekhar/ts-jest/issues/2623)

### [`v27.0.7`](https://github.com/kulshekhar/ts-jest/blob/HEAD/CHANGELOG.md#&#8203;2707-httpsgithubcomkulshekharts-jestcomparev2706v2707-2021-10-16)

[Compare Source](https://github.com/kulshekhar/ts-jest/compare/v27.0.6...v27.0.7)

##### Bug Fixes

-   correct `lodash` import ([#&#8203;2978](https://github.com/kulshekhar/ts-jest/issues/2978)) ([8b60679](https://github.com/kulshekhar/ts-jest/commit/8b60679574eb60a3c8109ffd389b64b86a167e72)), closes [#&#8203;2977](https://github.com/kulshekhar/ts-jest/issues/2977)

### [`v27.0.6`](https://github.com/kulshekhar/ts-jest/blob/HEAD/CHANGELOG.md#&#8203;2706-httpsgithubcomkulshekharts-jestcomparev2705v2706-2021-10-14)

[Compare Source](https://github.com/kulshekhar/ts-jest/compare/v27.0.5...v27.0.6)

##### Bug Fixes

-   use specific `lodash` package instead of full package `lodash` ([#&#8203;2959](https://github.com/kulshekhar/ts-jest/issues/2959)) ([dc89fe5](https://github.com/kulshekhar/ts-jest/commit/dc89fe55f2b77da76443f827fe3055f07cf4809c)), closes [#&#8203;2954](https://github.com/kulshekhar/ts-jest/issues/2954)

### [`v27.0.5`](https://github.com/kulshekhar/ts-jest/blob/HEAD/CHANGELOG.md#&#8203;2705-httpsgithubcomkulshekharts-jestcomparev2704v2705-2021-08-14)

[Compare Source](https://github.com/kulshekhar/ts-jest/compare/v27.0.4...v27.0.5)

##### Bug Fixes

-   **cli:** add migration `tsConfig` option for `ts-jest` config options ([#&#8203;2794](https://github.com/kulshekhar/ts-jest/issues/2794)) ([781710b](https://github.com/kulshekhar/ts-jest/commit/781710bf6b84853fffbb02543062a726fe1ad9c2)), closes [#&#8203;2764](https://github.com/kulshekhar/ts-jest/issues/2764)
-   **cli:** fix `config:init` genarate invalid type comment ([#&#8203;2773](https://github.com/kulshekhar/ts-jest/issues/2773)) ([ede8a20](https://github.com/kulshekhar/ts-jest/commit/ede8a2061e20b717c0d56e4d81a3cd0ec7db8b1a)), closes [#&#8203;2772](https://github.com/kulshekhar/ts-jest/issues/2772)
-   **config:** handle  `./` in tsconfig `paths` for `pathsToModuleNameMapper`  ([#&#8203;2797](https://github.com/kulshekhar/ts-jest/issues/2797)) ([42ff5e4](https://github.com/kulshekhar/ts-jest/commit/42ff5e469fb5d315b92e85eee105e5a040949c01)), closes [#&#8203;2709](https://github.com/kulshekhar/ts-jest/issues/2709)

##### Code Refactoring

-   use native `Buffer.from` and `mkdird` ([#&#8203;2774](https://github.com/kulshekhar/ts-jest/issues/2774)) ([4869660](https://github.com/kulshekhar/ts-jest/commit/4869660e3917deb063745c5acaf079123d6d2ca8))

### [`v27.0.4`](https://github.com/kulshekhar/ts-jest/blob/HEAD/CHANGELOG.md#&#8203;2704-httpsgithubcomkulshekharts-jestcomparev2703v2704-2021-07-21)

[Compare Source](https://github.com/kulshekhar/ts-jest/compare/v27.0.3...v27.0.4)

##### Bug Fixes

-   add `@types/jest` as optional `peerDependencies` to solve yarn 2 ([#&#8203;2756](https://github.com/kulshekhar/ts-jest/issues/2756)) ([5fbf43e](https://github.com/kulshekhar/ts-jest/commit/5fbf43e64691d5146add1da4690a14b3095c4234))
-   add `babel-jest` as optional `peerDependencies` to solve yarn 2 ([#&#8203;2751](https://github.com/kulshekhar/ts-jest/issues/2751)) ([8bede2e](https://github.com/kulshekhar/ts-jest/commit/8bede2e57546a18999b96871069f1f94a3ecf3c1))
-   **config:** include AST transformer's `name` and `version` into cache key ([#&#8203;2755](https://github.com/kulshekhar/ts-jest/issues/2755)) ([310fb9a](https://github.com/kulshekhar/ts-jest/commit/310fb9a1d7b40a8274d6fb93745e66a6da891a75)), closes [#&#8203;2753](https://github.com/kulshekhar/ts-jest/issues/2753)

##### Features

-   link jest config types on `npx ts-jest:init` ([#&#8203;2742](https://github.com/kulshekhar/ts-jest/issues/2742)) ([f51ba05](https://github.com/kulshekhar/ts-jest/commit/f51ba0507568ba8a5dece48c159d7857a2ed61d6))
-   set env var `TS_JEST` to allow detecting of `ts-jest` ([#&#8203;2717](https://github.com/kulshekhar/ts-jest/issues/2717)) ([56c137a](https://github.com/kulshekhar/ts-jest/commit/56c137a3c1906f49cb0b9e044fa8e233707cbaa4)), closes [#&#8203;2716](https://github.com/kulshekhar/ts-jest/issues/2716)

### [`v27.0.3`](https://github.com/kulshekhar/ts-jest/blob/HEAD/CHANGELOG.md#&#8203;2703-httpsgithubcomkulshekharts-jestcomparev2702v2703-2021-06-06)

[Compare Source](https://github.com/kulshekhar/ts-jest/compare/v27.0.2...v27.0.3)

##### Bug Fixes

-   revert `exports` field to support all node versions ([#&#8203;2658](https://github.com/kulshekhar/ts-jest/issues/2658)) ([132c8ba](https://github.com/kulshekhar/ts-jest/commit/132c8ba85c3e61b7d9ede0dc9730580b79618ab7))

##### Features

-   emit ESM codes if using ESM mode with Babel ([#&#8203;2661](https://github.com/kulshekhar/ts-jest/issues/2661)) ([9b55404](https://github.com/kulshekhar/ts-jest/commit/9b55404a8dfc760238e19786da98a2edf043b9da)), closes [#&#8203;2650](https://github.com/kulshekhar/ts-jest/issues/2650)

### [`v27.0.2`](https://github.com/kulshekhar/ts-jest/blob/HEAD/CHANGELOG.md#&#8203;2702-httpsgithubcomkulshekharts-jestcomparev2701v2702-2021-05-30)

[Compare Source](https://github.com/kulshekhar/ts-jest/compare/v27.0.1...v27.0.2)

##### Bug Fixes

-   **compiler:** add empty string file content to compiler cache ([#&#8203;2633](https://github.com/kulshekhar/ts-jest/issues/2633)) ([0feb556](https://github.com/kulshekhar/ts-jest/commit/0feb5560a588f87d1d989bf521859fba0fda20fe)), closes [#&#8203;2625](https://github.com/kulshekhar/ts-jest/issues/2625)
-   **config:** `exclude` should only exclude files which match glob values ([#&#8203;2637](https://github.com/kulshekhar/ts-jest/issues/2637)) ([c5ce979](https://github.com/kulshekhar/ts-jest/commit/c5ce97902c1b84dc354f270a4f596a6f5f634611)), closes [#&#8203;2634](https://github.com/kulshekhar/ts-jest/issues/2634)

### [`v27.0.1`](https://github.com/kulshekhar/ts-jest/blob/HEAD/CHANGELOG.md#&#8203;2701-httpsgithubcomkulshekharts-jestcomparev2700v2701-2021-05-26)

[Compare Source](https://github.com/kulshekhar/ts-jest/compare/v27.0.0...v27.0.1)

##### Bug Fixes

-   **cli:** keep `testMatch` if old jest config contains it ([#&#8203;2618](https://github.com/kulshekhar/ts-jest/issues/2618)) ([c568f49](https://github.com/kulshekhar/ts-jest/commit/c568f49907fb5559ba1e8c67f1ec5d5eb4af920a)), closes [#&#8203;2616](https://github.com/kulshekhar/ts-jest/issues/2616)
-   **compiler:** make sure `isolatedModules: false` use updated compiler options ([#&#8203;2628](https://github.com/kulshekhar/ts-jest/issues/2628)) ([348e30f](https://github.com/kulshekhar/ts-jest/commit/348e30f426803efc51ecba26ab42619938fcb5af)), closes [#&#8203;2629](https://github.com/kulshekhar/ts-jest/issues/2629)
-   add missing export `presets` ([#&#8203;2624](https://github.com/kulshekhar/ts-jest/issues/2624)) ([0ea025e](https://github.com/kulshekhar/ts-jest/commit/0ea025ebb456d3a31671e31fac0b401c2734a2b1)), closes [#&#8203;2623](https://github.com/kulshekhar/ts-jest/issues/2623)

### [`v27.0.0`](https://github.com/kulshekhar/ts-jest/blob/HEAD/CHANGELOG.md#&#8203;2700-httpsgithubcomkulshekharts-jestcomparev2656v2700-2021-05-25)

[Compare Source](https://github.com/kulshekhar/ts-jest/compare/v26.5.6...v27.0.0)

##### Bug Fixes

-   **compiler:** return file content on emitSkipped for non ts/tsx files ([#&#8203;2519](https://github.com/kulshekhar/ts-jest/issues/2519)) ([a4e5640](https://github.com/kulshekhar/ts-jest/commit/a4e5640f54a7810c9b7aba32663ce4a53893d22f)), closes [#&#8203;2513](https://github.com/kulshekhar/ts-jest/issues/2513)
-   **compiler:** retype check other files if processing file is used by those ones in watch mode ([#&#8203;2481](https://github.com/kulshekhar/ts-jest/issues/2481)) ([ac8f3d0](https://github.com/kulshekhar/ts-jest/commit/ac8f3d025de67bfc2708a8422ee657fc42455513)), closes [#&#8203;943](https://github.com/kulshekhar/ts-jest/issues/943)
-   **compiler:** initialize compiler with `.ts`/`.tsx`/`.d.ts` files only ([#&#8203;2458](https://github.com/kulshekhar/ts-jest/issues/2458)) ([a89f0e2](https://github.com/kulshekhar/ts-jest/commit/a89f0e2061e01440337dde4134639ff6a2d69936)), closes [#&#8203;2445](https://github.com/kulshekhar/ts-jest/issues/2445)
-   **compiler:** resolve nested imported modules for each processing file ([#&#8203;2436](https://github.com/kulshekhar/ts-jest/issues/2436)) ([3cb9019](https://github.com/kulshekhar/ts-jest/commit/3cb9019289bb64deecffaf52e840faf6a4656092)), closes [#&#8203;1390](https://github.com/kulshekhar/ts-jest/issues/1390) [#&#8203;1747](https://github.com/kulshekhar/ts-jest/issues/1747)
-   **config:** create fallback jest config when jest config is `undefined` ([#&#8203;2433](https://github.com/kulshekhar/ts-jest/issues/2433)) ([c6d6e4c](https://github.com/kulshekhar/ts-jest/commit/c6d6e4cd534e1c368fcb7141784ee43584525ca4)), closes [#&#8203;2085](https://github.com/kulshekhar/ts-jest/issues/2085)
-   remove `@types/jest` from direct dep ([#&#8203;2409](https://github.com/kulshekhar/ts-jest/issues/2409)) ([8913120](https://github.com/kulshekhar/ts-jest/commit/89131203c358c8f9e89655800e500a9e88a17334)), closes [#&#8203;2406](https://github.com/kulshekhar/ts-jest/issues/2406) [#&#8203;2411](https://github.com/kulshekhar/ts-jest/issues/2411)
-   **compiler:** return original file content and show warning on emit skip ([#&#8203;2410](https://github.com/kulshekhar/ts-jest/issues/2410)) ([c2b2164](https://github.com/kulshekhar/ts-jest/commit/c2b2164ddd1e606fc2490326244a6efc63f6c4a0)), closes [#&#8203;2407](https://github.com/kulshekhar/ts-jest/issues/2407)
-   **compiler:** type check correctly in watch mode when a file content itself has changed ([#&#8203;2405](https://github.com/kulshekhar/ts-jest/issues/2405)) ([064bf3a](https://github.com/kulshekhar/ts-jest/commit/064bf3a73e9a304aa9366d27db8973b68be23ffd)), closes [#&#8203;2118](https://github.com/kulshekhar/ts-jest/issues/2118)
-   **compiler:** exclude files in `outDir` from compiler source files ([#&#8203;2375](https://github.com/kulshekhar/ts-jest/issues/2375)) ([ec68c74](https://github.com/kulshekhar/ts-jest/commit/ec68c74bccf56d682a7ed9e5c48ea676dcf3fbf9)), closes [#&#8203;2350](https://github.com/kulshekhar/ts-jest/issues/2350) [#&#8203;2374](https://github.com/kulshekhar/ts-jest/issues/2374)
-   **config:** cache config and compiler correctly between runs ([#&#8203;2356](https://github.com/kulshekhar/ts-jest/issues/2356)) ([5f91336](https://github.com/kulshekhar/ts-jest/commit/5f91336b9023da1051cc85b509ad02c525679fcb))
-   **config:** improve emit skipped error message ([#&#8203;2358](https://github.com/kulshekhar/ts-jest/issues/2358)) ([2ae8df4](https://github.com/kulshekhar/ts-jest/commit/2ae8df4515d6f6e975e57719a89184b5583f9e2f)), closes [#&#8203;2350](https://github.com/kulshekhar/ts-jest/issues/2350)
-   **typings:** set correct typing for `tsconfig` option ([#&#8203;2383](https://github.com/kulshekhar/ts-jest/issues/2383)) ([584324a](https://github.com/kulshekhar/ts-jest/commit/584324a60c0784275e9bf8bcfd0814735a250d24)), closes [#&#8203;2368](https://github.com/kulshekhar/ts-jest/issues/2368)
-   **config:** invalidate Jest transform cache when `astTransformers` value changes ([#&#8203;2345](https://github.com/kulshekhar/ts-jest/issues/2345)) ([d726016](https://github.com/kulshekhar/ts-jest/commit/d726016a17a26215fad782cf57bb9b9bec807307))
-   reduce size of `node_modules` when adding `ts-jest` ([#&#8203;2263](https://github.com/kulshekhar/ts-jest/issues/2263)) ([8e0675c](https://github.com/kulshekhar/ts-jest/commit/8e0675c02b6095af6656df50c8782c01ad9e87a3))

##### Features

-   **config:** allow disable sourcemap ([#&#8203;2544](https://github.com/kulshekhar/ts-jest/issues/2544)) ([47da6ad](https://github.com/kulshekhar/ts-jest/commit/47da6ada5089e58e9bc68ce8e9bc9e17aaa127ae))
-   **compiler:** expose `TsCompiler` as public api ([#&#8203;2344](https://github.com/kulshekhar/ts-jest/issues/2344)) ([871cd6a](https://github.com/kulshekhar/ts-jest/commit/871cd6a3abb10569a04d05f72bbb41c952665ed4))
-   **config:** support typed config options for jest config typescript ([#&#8203;2335](https://github.com/kulshekhar/ts-jest/issues/2335)) ([3cfc37b](https://github.com/kulshekhar/ts-jest/commit/3cfc37b1eba125fe861cea0415095dbe1f538520))
-   **presets:** add typing for `presets` entry point ([#&#8203;2337](https://github.com/kulshekhar/ts-jest/issues/2337)) ([1a3058f](https://github.com/kulshekhar/ts-jest/commit/1a3058f3b7f8a2e377cb6a7e829cea310a06d4fa))
-   **compiler:** allow custom transformers to access internal `Program` ([#&#8203;2299](https://github.com/kulshekhar/ts-jest/issues/2299)) ([387964f](https://github.com/kulshekhar/ts-jest/commit/387964faed14ce24d2cf8170a04eee244d69b8b9))
-   **config:** replace `pathRegex` with `exclude` ([#&#8203;2295](https://github.com/kulshekhar/ts-jest/issues/2295)) ([f2f99c3](https://github.com/kulshekhar/ts-jest/commit/f2f99c3a46ac18a1fd6cc98922329b71a7e8c4e8))
-   **config:** type checking `js` files based on `checkJs` ([#&#8203;2283](https://github.com/kulshekhar/ts-jest/issues/2283)) ([1e04433](https://github.com/kulshekhar/ts-jest/commit/1e044335a38907ff5c06eb43efeb2e5fd9769a0c))
-   **compiler:** support ESM for `isolatedModules: false` ([#&#8203;2269](https://github.com/kulshekhar/ts-jest/issues/2269)) ([9bb0c05](https://github.com/kulshekhar/ts-jest/commit/9bb0c054a3a7bd8949b0c12b2bb42348f69e2e2e)), closes [#&#8203;1709](https://github.com/kulshekhar/ts-jest/issues/1709)
-   **compiler:** support ESM for `isolatedModule: true` ([#&#8203;2219](https://github.com/kulshekhar/ts-jest/issues/2219)) ([e101db0](https://github.com/kulshekhar/ts-jest/commit/e101db01095ce75ce9a48e27a1d9bf84bb8e19ee)), closes [#&#8203;1709](https://github.com/kulshekhar/ts-jest/issues/1709)
-   **presets:** add 3 new presets to work with ESM ([#&#8203;2207](https://github.com/kulshekhar/ts-jest/issues/2207)) ([c277858](https://github.com/kulshekhar/ts-jest/commit/c277858c7820d8873c2d7d0c6e3704a47868d600))
-   allow subclasses of `TsJestTransformer` to have version checking ([#&#8203;2176](https://github.com/kulshekhar/ts-jest/issues/2176)) ([ca8d7c4](https://github.com/kulshekhar/ts-jest/commit/ca8d7c44779105ef208d17cdd8c6baaf96b479ad))

##### Performance Improvements

-   reuse jest file system cache for `isolatedModules: false` ([#&#8203;2189](https://github.com/kulshekhar/ts-jest/issues/2189)) ([68f446b](https://github.com/kulshekhar/ts-jest/commit/68f446b8351bb8925ac4822aa631aa6b23f2f711))

##### Code Refactoring

-   **config:** remove support for `astTransformers` string array ([#&#8203;2129](https://github.com/kulshekhar/ts-jest/issues/2129)) ([1e0b2ce](https://github.com/kulshekhar/ts-jest/commit/1e0b2ce5599a35c108712456e455bf29c8c5fd24))
-   **config:** remove support for `packageJson` option ([#&#8203;2128](https://github.com/kulshekhar/ts-jest/issues/2128)) ([05916b9](https://github.com/kulshekhar/ts-jest/commit/05916b920160da5b43a20b47025eea43b4a1a5c3))
-   move jest transformer class to package entry ([#&#8203;2122](https://github.com/kulshekhar/ts-jest/issues/2122)) ([5bbfd06](https://github.com/kulshekhar/ts-jest/commit/5bbfd06a0c114dbecd75b763bcfa76d4a6203ab1))
-   **config:** remove support for `tsConfig` option ([#&#8203;2127](https://github.com/kulshekhar/ts-jest/issues/2127)) ([3cc9b80](https://github.com/kulshekhar/ts-jest/commit/3cc9b806be2b2096b981253d39ca40df65bb0f7b))

#### BREAKING CHANGES

-   By default, `ts-jest` will use `sourceMap` option from your `tsconfig`. If users want to have sourcemap on, they need to set `sourceMap: true` in `tsconfig`.
-   follow Jest support Node engines ([#&#8203;2478](https://github.com/kulshekhar/ts-jest/pull/2478)) ([1fecf7f](https://github.com/kulshekhar/ts-jest/commit/1fecf7ff92a5f1a0cc6ea1d27026f9f54a3d5ead))
-   add `exports` field to `package.json`, see https://nodejs.org/api/packages.html#packages_package_entry_points ([#&#8203;2467](https://github.com/kulshekhar/ts-jest/pull/2467)) ([d3aba3e](https://github.com/kulshekhar/ts-jest/commit/d3aba3e103f85b3a42d0e2ecaea9d3457917319e))
-   `ts-jest` custom AST transformer function signature has changed to

<!---->

    import type { TsCompilerInstance } from 'ts-jest/dist/types'

    export function factory(compilerInstance: TsCompilerInstance) {
       //...
    }

-   One is currently using `pathRegex` should use `exclude` with `glob` patterns.
-   If one currently relies on type check for `js` files, please set `checkJs: true` in your tsconfig.
-   Now both `isolatedModules: true` and `isolatedModule: false` codes are in one single class `TsCompiler` which is an instance created in `TsJestCompiler` based on config option `compiler` with value `typescript` or `ttypescript`.
-   **config:** `packageJson` config option is not used in internal `ts-jest` so this option is now removed.
-   **config:** One is defining ast transformers in `jest.config.js`/`package.json` should change to

<!---->

    // jest.config.js
    module.exports = {
       //...
       globals: {
          'ts-jest': {
             astTransformers: {
               before: ['your_before_transformer_path'],
               after: ['your_after_transformer_path'],
               afterDeclarations: ['your_afterDeclarations_transformer_path'],
             }
          }
       }
    }

or

    // package.json
    {
      "jest": {
         "globals": {
            "ts-jest": {
               "astTransformers": {
                  "before": ["your_before_transformer_path"],
                  "after": ["your_after_transformer_path"],
                  "afterDeclarations": ["your_afterDeclarations_transformer_path"]
               }
            }
         }
      }
    }

-   One currently refers type in `jest.config.js`

<!---->

    /** @&#8203;typedef {import('ts-jest')} */
    module.exports = {
      //...
    }

should change to

    /** @&#8203;typedef {import('ts-jest/dist/types')} */
    module.exports = {
      //...
    }

-   Remove possibilities to import `mocked`, `createJestPreset`, `pathsToModuleNameMapper` from package entry. One should change to

<!---->

    import { mocked, createJestPreset, pathsToModuleNameMapper } from 'ts-jest/utils'

-   **config:** One currently uses `tsConfig` should change to `tsconfig` in your `jest.config.js` or `package.json`.

#### [26.5.6](https://github.com/kulshekhar/ts-jest/compare/v26.5.5...v26.5.6) (2021-05-05)

##### Code Refactoring

-   refactor(config): show warning message for `sourceMap: false` ([#&#8203;2557](https://github.com/kulshekhar/ts-jest/pull/2557)) ([cf60990](https://github.com/kulshekhar/ts-jest/commit/cf609900e2c5937755123bd08ca2c5f2ff5e0651)).

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNC43NC4yIiwidXBkYXRlZEluVmVyIjoiMzQuNzQuMiJ9-->

Co-authored-by: Renovate Bot <renovate@vylpes.com>
Reviewed-on: https://gitea.vylpes.xyz/RabbitLabs/Droplet/pulls/110
Reviewed-by: Vylpes <ethan@vylpes.com>
Co-authored-by: RenovateBot <renovate@vylpes.com>
Co-committed-by: RenovateBot <renovate@vylpes.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🚀 Feature Request new suggested feature
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants