-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Description
Current behavior
If package.json is configured with Node.js type field set to module (instead of left undefined or set to commonjs), Typescript is installed and config.cypress.ts is present, then the following warning is output when running Cypress:
DevTools listening on ws://127.0.0.1:34161/devtools/browser/b3805bff-7dbc-4403-8aa2-2b24de43ca12
(node:4680) ExperimentalWarning:--experimental-loadermay be removed in the future; instead useregister():
--import 'data:text/javascript,import { register } from "node:module"; import { pathToFileURL } from "node:url"; register("file%3A///home/mike/.cache/Cypress/14.0.3/Cypress/resources/app/node_modules/ts-node/esm/transpile-only.mjs", pathToFileURL("./"));'
(Usenode --trace-warnings ...to show where the warning was created)
(node:4680) [DEP0180] DeprecationWarning: fs.Stats constructor is deprecated.
(Usenode --trace-deprecation ...to show where the warning was created)
Desired behavior
Cypress should not show any warning when set up as a TypeScript project and package.json includes "type": "module" for an ESM project.
Test code to reproduce
https://github.com/MikeMcC399/cypress-test-tiny/tree/30318-ts-module
git clone --branch 30318-ts-module https://github.com/MikeMcC399/cypress-test-tiny
cd cypress-test-tiny
npm ci
npx cypress runCypress Version
First reported on Cypress version: 13.15.0
Continues to be reproducible on version: 14.3.3
Node version
v20.17.0 and
v22.13.1 LTS (see below for additional warnings with this version)
v22.15.0 LTS
Operating System
Ubuntu 24.04.1 LTS24.04.2 LTS
Debug Logs
DevTools listening on ws://127.0.0.1:34161/devtools/browser/b3805bff-7dbc-4403-8aa2-2b24de43ca12
(node:4680) ExperimentalWarning: `--experimental-loader` may be removed in the future; instead use `register()`:
--import 'data:text/javascript,import { register } from "node:module"; import { pathToFileURL } from "node:url"; register("file%3A///home/mike/.cache/Cypress/14.0.3/Cypress/resources/app/node_modules/ts-node/esm/transpile-only.mjs", pathToFileURL("./"));'
(Use `node --trace-warnings ...` to show where the warning was created)
(node:4680) [DEP0180] DeprecationWarning: fs.Stats constructor is deprecated.
(Use `node --trace-deprecation ...` to show where the warning was created)
Other
Typescript version: 5.6.25.7.3
- Overlaps with
ERR_INTERNAL_ASSERTIONwith Node.js >= v22.1.0 andexperimental-detect-moduleset #30101 - Remains after resolving Cypress + Vite 5 + Typescript: exports is not defined in ES module scope #30313
With Node.js v22.11.0 LTS there is an additional warning
(node:6696) [DEP0180] DeprecationWarning: fs.Stats constructor is deprecated.
which comes from ts-node (see issue TypeStrong/ts-node#2116)