Skip to content

Commit becd3da

Browse files
authored
chore: update typescript docs to tsx (#6155)
* 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
1 parent 065e567 commit becd3da

File tree

2 files changed

+16
-25
lines changed

2 files changed

+16
-25
lines changed

docs/app/references/changelog.mdx

+4
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ sidebar_label: Changelog
88

99
# Changelog
1010

11+
## 15.0.0
12+
13+
_Released 7/01/2025 (PENDING)_
14+
1115
## 14.2.1
1216

1317
_Released 3/26/2025_

docs/app/tooling/typescript-support.mdx

+12-25
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ tests in TypeScript.
2929

3030
### Install TypeScript
3131

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
3333
already have TypeScript installed as a part of your framework, you will need to
3434
install it:
3535

@@ -61,8 +61,8 @@ with the following configuration:
6161
```json title="tsconfig.json"
6262
{
6363
"compilerOptions": {
64-
"target": "es5",
65-
"lib": ["es5", "dom"],
64+
"target": "es6",
65+
"lib": ["es6", "dom"],
6666
"sourceMap": true,
6767
"types": ["cypress", "node"]
6868
},
@@ -94,23 +94,9 @@ If that does not work, try restarting the IDE.
9494

9595
### Processing your Cypress configuration and plugins
9696

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.
9898

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.
114100

115101
## Extending TypeScript Support
116102

@@ -380,12 +366,13 @@ root `tsconfig.json` file.
380366

381367
## History
382368

383-
| Version | Changes |
384-
| ------------------------------------------ | ------------------------------------------------------------------------------------------ |
385-
| [13.0.0](/app/references/changelog#13-0-0) | Raised minimum required TypeScript version from 3.4+ to 4.0+ |
386-
| [10.0.0](/app/references/changelog#10-0-0) | Update guide to cover TypeScript setup for component testing |
387-
| [5.0.0](/app/references/changelog#5-0-0) | Raised minimum required TypeScript version from 2.9+ to 3.4+ |
388-
| [4.4.0](/app/references/changelog#4-4-0) | Added support for TypeScript without needing your own transpilation through preprocessors. |
369+
| Version | Changes |
370+
| ------------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------- |
371+
| [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. |
389376

390377
## See also
391378

0 commit comments

Comments
 (0)