-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Description
Current behavior
Running Cypress with TypeScript 6+ produces compiler errors about deprecated TypeScript options, even though these options are not defined in the project's tsconfig.json (i.e. they are injected)
Desired behavior
Cypress should not inject compilerOptions.downlevelIteration if the compilerOptions.target is set to es6 (https://www.typescriptlang.org/tsconfig/#downlevelIteration). Neither should cypress rely on "moduleResolution": "classic" (see https://www.typescriptlang.org/tsconfig/#moduleResolution)
Test code to reproduce
Minimal reproduction repository: https://github.com/devinant/cypress-ts6
Steps to reproduce:
npm install
npx cypress run --spec "cypress/e2e/1-getting-started/todo.cy.js"
The TypeScript deprecation errors will appear during the Cypress run and the tests won't run.
Cypress Version
10.15.0
Debug Logs
====================================================================================================
(Run Starting)
┌────────────────────────────────────────────────────────────────────────────────────────────────┐
│ Cypress: 15.10.0 │
│ Browser: Electron 138 (headless) │
│ Node Version: v20.19.0 (/Users/dino/.nvm/versions/node/v20.19.0/bin/node) │
│ Specs: 1 found (todo.cy.js) │
│ Searched: cypress/e2e/1-getting-started/todo.cy.js │
└────────────────────────────────────────────────────────────────────────────────────────────────┘
────────────────────────────────────────────────────────────────────────────────────────────────────
Running: todo.cy.js (1 of 1)
Oops...we found an error preparing this test file:
> cypress/support/e2e.ts
The error was:
Error: Webpack Compilation Error
[tsl] ERROR
TS5101: Option 'downlevelIteration' is deprecated and will stop functioning in TypeScript 7.0. Specify compilerOption '"ignoreDeprecations": "6.0"' to silence this error.
[tsl] ERROR
TS5107: Option 'moduleResolution=classic' is deprecated and will stop functioning in TypeScript 7.0. Specify compilerOption '"ignoreDeprecations": "6.0"' to silence this error.
[tsl] ERROR
TS5101: Option 'downlevelIteration' is deprecated and will stop functioning in TypeScript 7.0. Specify compilerOption '"ignoreDeprecations": "6.0"' to silence this error.
[tsl] ERROR
TS5107: Option 'moduleResolution=classic' is deprecated and will stop functioning in TypeScript 7.0. Specify compilerOption '"ignoreDeprecations": "6.0"' to silence this error.
[tsl] ERROR
TS5101: Option 'downlevelIteration' is deprecated and will stop functioning in TypeScript 7.0. Specify compilerOption '"ignoreDeprecations": "6.0"' to silence this error.
[tsl] ERROR
TS5107: Option 'moduleResolution=classic' is deprecated and will stop functioning in TypeScript 7.0. Specify compilerOption '"ignoreDeprecations": "6.0"' to silence this error.
at handle (/Users/dino/Library/Caches/Cypress/15.10.0/Cypress.app/Contents/Resources/app/packages/server/node_modules/@cypress/webpack-preprocessor/dist/index.js:296:23)
at finalCallback (/Users/dino/Library/Caches/Cypress/15.10.0/Cypress.app/Contents/Resources/app/node_modules/webpack/lib/Compiler.js:500:32)
at /Users/dino/Library/Caches/Cypress/15.10.0/Cypress.app/Contents/Resources/app/node_modules/webpack/lib/Compiler.js:578:17
at /Users/dino/Library/Caches/Cypress/15.10.0/Cypress.app/Contents/Resources/app/node_modules/webpack/lib/HookWebpackError.js:67:2
at Hook.eval [as callAsync] (eval at create (/Users/dino/Library/Caches/Cypress/15.10.0/Cypress.app/Contents/Resources/app/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:6:1)
at Hook.CALL_ASYNC_DELEGATE [as _callAsync] (/Users/dino/Library/Caches/Cypress/15.10.0/Cypress.app/Contents/Resources/app/node_modules/tapable/lib/Hook.js:18:14)
at Cache.storeBuildDependencies (/Users/dino/Library/Caches/Cypress/15.10.0/Cypress.app/Contents/Resources/app/node_modules/webpack/lib/Cache.js:126:37)
at /Users/dino/Library/Caches/Cypress/15.10.0/Cypress.app/Contents/Resources/app/node_modules/webpack/lib/Compiler.js:574:19
at Hook.eval [as callAsync] (eval at create (/Users/dino/Library/Caches/Cypress/15.10.0/Cypress.app/Contents/Resources/app/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:6:1)
at Hook.CALL_ASYNC_DELEGATE [as _callAsync] (/Users/dino/Library/Caches/Cypress/15.10.0/Cypress.app/Contents/Resources/app/node_modules/tapable/lib/Hook.js:18:14)
at /Users/dino/Library/Caches/Cypress/15.10.0/Cypress.app/Contents/Resources/app/node_modules/webpack/lib/Compiler.js:570:23
at Compiler.emitRecords (/Users/dino/Library/Caches/Cypress/15.10.0/Cypress.app/Contents/Resources/app/node_modules/webpack/lib/Compiler.js:1046:4)
at /Users/dino/Library/Caches/Cypress/15.10.0/Cypress.app/Contents/Resources/app/node_modules/webpack/lib/Compiler.js:560:11
at /Users/dino/Library/Caches/Cypress/15.10.0/Cypress.app/Contents/Resources/app/node_modules/webpack/lib/Compiler.js:1009:14
at Hook.eval [as callAsync] (eval at create (/Users/dino/Library/Caches/Cypress/15.10.0/Cypress.app/Contents/Resources/app/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:6:1)
at Hook.CALL_ASYNC_DELEGATE [as _callAsync] (/Users/dino/Library/Caches/Cypress/15.10.0/Cypress.app/Contents/Resources/app/node_modules/tapable/lib/Hook.js:18:14)
at /Users/dino/Library/Caches/Cypress/15.10.0/Cypress.app/Contents/Resources/app/node_modules/webpack/lib/Compiler.js:1006:27
at /Users/dino/Library/Caches/Cypress/15.10.0/Cypress.app/Contents/Resources/app/node_modules/neo-async/async.js:2818:7
at done (/Users/dino/Library/Caches/Cypress/15.10.0/Cypress.app/Contents/Resources/app/node_modules/neo-async/async.js:3522:9)
at alreadyWritten (/Users/dino/Library/Caches/Cypress/15.10.0/Cypress.app/Contents/Resources/app/node_modules/webpack/lib/Compiler.js:811:8)
at /Users/dino/Library/Caches/Cypress/15.10.0/Cypress.app/Contents/Resources/app/node_modules/webpack/lib/Compiler.js:922:17
at /Users/dino/Library/Caches/Cypress/15.10.0/Cypress.app/Contents/Resources/app/node_modules/graceful-fs/graceful-fs.js:123:16
at /Users/dino/Library/Caches/Cypress/15.10.0/Cypress.app/Contents/Resources/app/packages/server/node_modules/graceful-fs/graceful-fs.js:123:16
at /Users/dino/Library/Caches/Cypress/15.10.0/Cypress.app/Contents/Resources/app/packages/server/node_modules/graceful-fs/graceful-fs.js:123:16
at FSReqCallback.readFileAfterClose [as oncomplete] (node:internal/fs/read/context:68:3)
This occurred while Cypress was compiling and bundling your test code. This is usually caused by:
- A missing file or dependency
- A syntax error in the file or one of its dependencies
Fix the error in your code and re-run your tests.
(Results)
┌────────────────────────────────────────────────────────────────────────────────────────────────┐
│ Tests: 0 │
│ Passing: 0 │
│ Failing: 1 │
│ Pending: 0 │
│ Skipped: 0 │
│ Screenshots: 0 │
│ Video: false │
│ Duration: 0 seconds │
│ Spec Ran: todo.cy.js │
└────────────────────────────────────────────────────────────────────────────────────────────────┘
====================================================================================================Other
Temporary workaround:
{
"compilerOptions": {
+ "ignoreDeprecations": "6.0",
"target": "es6",
"lib": ["es6", "dom"],
"sourceMap": true,
"types": ["cypress", "node"]
}
}I'm aware that TS6 is currently in beta and this may not be officially supported. If this is expected behaviour while TS6 is still in beta, please feel free to close the issue :). I just wanted to provide a minimal reproduction in case it is helpful.
Thanks!