You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: website/docs/getting-started/installation.md
+5-1Lines changed: 5 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -19,7 +19,11 @@ npm install --save-dev jest typescript ts-jest
19
19
yarn add --dev jest typescript ts-jest
20
20
```
21
21
22
-
> Tip: If you get an error with the following `npm` commands such as `npx: command not found`, you can replace `npx XXX` with `node node_modules/.bin/XXX` from the root of your project.
22
+
:::tip
23
+
24
+
Tip: If you get an error with the following `npm` commands such as `npx: command not found`, you can replace `npx XXX` with `node node_modules/.bin/XXX` from the root of your project.
Copy file name to clipboardExpand all lines: website/docs/introduction.md
+5-2Lines changed: 5 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,5 +9,8 @@ slug: /
9
9
10
10
It supports all features of TypeScript including type-checking. [Read more about Babel7 + `preset-typescript`**vs** TypeScript (and `ts-jest`)](babel7-or-ts).
11
11
12
-
| We are not doing semantic versioning and `23.10` is a re-write, run `npm i -D ts-jest@"<23.10.0"` to go back to the previous version |
Copy file name to clipboardExpand all lines: website/versioned_docs/version-26.5/getting-started/installation.md
+5-1Lines changed: 5 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -19,7 +19,11 @@ npm install --save-dev jest typescript ts-jest
19
19
yarn add --dev jest typescript ts-jest
20
20
```
21
21
22
-
> Tip: If you get an error with the following `npm` commands such as `npx: command not found`, you can replace `npx XXX` with `node node_modules/.bin/XXX` from the root of your project.
22
+
:::tip
23
+
24
+
Tip: If you get an error with the following `npm` commands such as `npx: command not found`, you can replace `npx XXX` with `node node_modules/.bin/XXX` from the root of your project.
Copy file name to clipboardExpand all lines: website/versioned_docs/version-26.5/getting-started/options.md
-2Lines changed: 0 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -65,7 +65,6 @@ All options have default values which should fit most of the projects. Click on
65
65
|[**`diagnostics`**][diagnostics]|[Diagnostics related configuration.][diagnostics]|`boolean`\|`object`|_enabled_|
66
66
|[**`babelConfig`**][babelconfig]|[Babel(Jest) related configuration.][babelconfig]|`boolean`\|`string`\|`object`|_disabled_|
67
67
|[**`stringifyContentPathRegex`**][stringifycontentpathregex]|[Files which will become modules returning self content.][stringifycontentpathregex]|`string`\|`RegExp`|_disabled_|
|`ts-jest/presets/default`<br/>or `ts-jest`| TypeScript files (`.ts`, `.tsx`) will be transformed by `ts-jest` to **CommonJS** syntax, leaving JavaScript files (`.js`, `jsx`) as-is. |
13
-
|`ts-jest/presets/default-esm`<br/> | TypeScript files (`.ts`, `.tsx`) will be transformed by `ts-jest` to **ESM** syntax, leaving JavaScript files (`.js`, `jsx`) as-is. |
14
-
|`ts-jest/presets/js-with-ts`| TypeScript and JavaScript files (`.ts`, `.tsx`, `.js`, `.jsx`) will be transformed by `ts-jest` to **CommonJS** syntax.<br/>You'll need to set `allowJs` to `true` in your `tsconfig.json` file. |
15
-
|`ts-jest/presets/js-with-ts-esm`| TypeScript and JavaScript files (`.ts`, `.tsx`, `.js`, `.jsx`, `.mjs`) will be transformed by `ts-jest` to **ESM** syntax.<br/>You'll need to set `allowJs` to `true` in your `tsconfig.json` file. |
16
-
|`ts-jest/presets/js-with-babel`| TypeScript files (`.ts`, `.tsx`) will be transformed by `ts-jest` to **CommonJS** syntax, and JavaScript files (`.js`, `jsx`) will be transformed by `babel-jest`. |
17
-
|`ts-jest/presets/js-with-babel-esm`| TypeScript files (`.ts`, `.tsx`) will be transformed by `ts-jest` to **ESM** syntax, and JavaScript files (`.js`, `jsx`, `.mjs`) will be transformed by `babel-jest`. |
|`ts-jest/presets/default`<br/>or `ts-jest`| TypeScript files (`.ts`, `.tsx`) will be transformed by `ts-jest` to **CommonJS** syntax, leaving JavaScript files (`.js`, `jsx`) as-is. |
13
+
|`ts-jest/presets/js-with-ts`| TypeScript and JavaScript files (`.ts`, `.tsx`, `.js`, `.jsx`) will be transformed by `ts-jest` to **CommonJS** syntax.<br/>You'll need to set `allowJs` to `true` in your `tsconfig.json` file. |
14
+
|`ts-jest/presets/js-with-babel`| TypeScript files (`.ts`, `.tsx`) will be transformed by `ts-jest` to **CommonJS** syntax, and JavaScript files (`.js`, `jsx`) will be transformed by `babel-jest`. |
18
15
19
16
### Basic usage
20
17
@@ -53,11 +50,8 @@ In this case you'll need to use the JavaScript version of Jest config (comment/u
Copy file name to clipboardExpand all lines: website/versioned_docs/version-26.5/guides/esm-support.md
+3-65Lines changed: 3 additions & 65 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,70 +3,8 @@ id: esm-support
3
3
title: ESM Support
4
4
---
5
5
6
-
To use `ts-jest` with ESM support, you'll first need to check [ESM Jest documentation](https://jestjs.io/docs/en/ecmascript-modules).
6
+
:::important
7
7
8
-
`ts-jest` supports ESM via a config option [useESM](../getting-started/options/useESM)in combination with jest config option [extensionsToTreatAsEsm](https://jestjs.io/docs/en/next/configuration#extensionstotreatasesm-arraystring).
8
+
ESM support is only available in **v27**
9
9
10
-
There are also [3 presets](../getting-started/presets.md) to work with ESM.
11
-
12
-
### Examples
13
-
14
-
#### Manual configuration
15
-
16
-
```js
17
-
// jest.config.js
18
-
module.exports= {
19
-
// [...]
20
-
extensionsToTreatAsEsm: ['.ts'],
21
-
globals: {
22
-
'ts-jest': {
23
-
useESM:true,
24
-
},
25
-
},
26
-
}
27
-
```
28
-
29
-
```json
30
-
// OR package.json
31
-
{
32
-
// [...]
33
-
"jest": {
34
-
"extensionsToTreatAsEsm": [".ts"],
35
-
"globals": {
36
-
"ts-jest": {
37
-
"useESM": true
38
-
}
39
-
}
40
-
}
41
-
}
42
-
```
43
-
44
-
#### Use ESM presets
45
-
46
-
```js
47
-
// jest.config.js
48
-
module.exports= {
49
-
// [...]
50
-
preset:'ts-jest/presets/default-esm', // or other ESM presets
51
-
globals: {
52
-
'ts-jest': {
53
-
useESM:true,
54
-
},
55
-
},
56
-
}
57
-
```
58
-
59
-
```json
60
-
// OR package.json
61
-
{
62
-
// [...]
63
-
"jest": {
64
-
"preset": "ts-jest/presets/default-esm", // or other ESM presets,
Copy file name to clipboardExpand all lines: website/versioned_docs/version-26.5/introduction.md
+5-2Lines changed: 5 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,5 +9,8 @@ slug: /
9
9
10
10
It supports all features of TypeScript including type-checking. [Read more about Babel7 + `preset-typescript`**vs** TypeScript (and `ts-jest`)](babel7-or-ts).
11
11
12
-
| We are not doing semantic versioning and `23.10` is a re-write, run `npm i -D ts-jest@"<23.10.0"` to go back to the previous version |
0 commit comments