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
* chore: remove ts-node references and workarounds and replace them with tsx
* add empty changelog entry for 15 to allow for linked out changes to build
Copy file name to clipboardExpand all lines: docs/app/tooling/typescript-support.mdx
+12-25
Original file line number
Diff line number
Diff line change
@@ -29,7 +29,7 @@ tests in TypeScript.
29
29
30
30
### Install TypeScript
31
31
32
-
To use TypeScript with Cypress, you will need TypeScript 4.0+. If you do not
32
+
To use TypeScript with Cypress, you will need TypeScript 5.0+. If you do not
33
33
already have TypeScript installed as a part of your framework, you will need to
34
34
install it:
35
35
@@ -61,8 +61,8 @@ with the following configuration:
61
61
```json title="tsconfig.json"
62
62
{
63
63
"compilerOptions": {
64
-
"target": "es5",
65
-
"lib": ["es5", "dom"],
64
+
"target": "es6",
65
+
"lib": ["es6", "dom"],
66
66
"sourceMap": true,
67
67
"types": ["cypress", "node"]
68
68
},
@@ -94,23 +94,9 @@ If that does not work, try restarting the IDE.
94
94
95
95
### Processing your Cypress configuration and plugins
96
96
97
-
Cypress needs to be able to transpile your Cypress configuration and plugins written in TypeScript in order to make them executable within Cypress's Node.js runtime. To do this, Cypress will attempt to read the user's TypeScript and project configuration to apply the correct TypeScript loader to Cypress's Node.js runtime.
97
+
Under the hood, Cypress uses [tsx](https://tsx.is/)to parse and run the `cypress.config.ts` file.
98
98
99
-
If your project is an `ESM` package (short for [ECMAScript Module](https://nodejs.org/api/esm.html#modules-ecmascript-modules)), Cypress attempts to apply the [ts-node/esm](https://github.com/TypeStrong/ts-node?tab=readme-ov-file#esm) Node.js loader to resolve the Cypress configuration and plugins. `ESM` is determined by Cypress if you have the `type: "module"` key-value pair present inside your project's `package.json`.
100
-
101
-
Otherwise, regular [ts-node](https://github.com/TypeStrong/ts-node?tab=readme-ov-file#node-flags-and-other-tools) is required into Cypress's Node.js runtime.
102
-
Since Node.js by itself can only interpret CommonJS files, Cypress attempts to make your TypeScript configuration compatible with Cypress' Node.js runtime.
103
-
To do this, Cypress overrides the following configuration values found inside your project's `tsconfig.json`:
104
-
105
-
```json
106
-
{
107
-
"module": "commonjs",
108
-
"moduleResolution": "node",
109
-
"preserveValueImports": false
110
-
}
111
-
```
112
-
113
-
This does not have an impact on your project or its TypeScript configuration settings. This override only happens within the context of the Cypress runtime.
99
+
This allows Cypress to run your TypeScript configuration inside the Cypress runtime without being bound to limitations of Node or other loaders.
|[15.0.0](/app/references/changelog#15-0-0)| Raised minimum required TypeScript version from 4.0+ to 5.0+ and replaced `ts-node` with `tsx` to parse and run the `cypress.config.ts` file. |
372
+
|[13.0.0](/app/references/changelog#13-0-0)| Raised minimum required TypeScript version from 3.4+ to 4.0+ |
373
+
|[10.0.0](/app/references/changelog#10-0-0)| Update guide to cover TypeScript setup for component testing |
374
+
|[5.0.0](/app/references/changelog#5-0-0)| Raised minimum required TypeScript version from 2.9+ to 3.4+ |
375
+
|[4.4.0](/app/references/changelog#4-4-0)| Added support for TypeScript without needing your own transpilation through preprocessors. |
0 commit comments