After update to Cypress 5.1, tests breaks throwing TS5053: Option 'sourceMap' cannot be specified with option 'inlineSourceMap'.
If I set inlineSourceMap to false, the error persist.
If I set sourceMap to false, test start working again.
Given that the default for inlineSourceMap is false, that I do not set it, and that it breaks only on newer versions, I'd say the new webpack preprocessor forces the inlineSourceMap option to true somewhere.
This is strange because it seems like you have a whole file in place to manage this scenario: https://github.com/cypress-io/cypress-webpack-preprocessor/blob/master/lib/typescript-overrides.ts
Tests should keep working without problems
Using a tsconfig with sourceMap: true option do the trick.
Edited to add repro:
https://github.com/IlCallo/cypress-test-tiny/tree/ts-sourcemap-conflict
yarn installyarn cypress:openCypress: 5.1.0
OS: Ubuntu 18.04
Could you please prepare a repository that we can run with a reproducible example?
@bahmutov
Here it is: https://github.com/IlCallo/cypress-test-tiny/tree/ts-sourcemap-conflict
yarn installyarn cypress:openGiven the thumbs up to the original post, seems like I'm not the only one
I have the same issue as well. Any feedback?
Cypress: 5.1.0
OS: Ubuntu 20.04
Note that is also happens with Cypress 5.0.0 but not on 4.12.1.
As a workaround until this issue is fixed, did someone know if it is possible to specify which tsconfig.json Cypress should use?
E.g. a tsconfig-cypress.json:
{
"extends": "./tsconfig.json",
"sourceMap": false
}
Thanks
AFAIK you can only do this via the webpack loader which takes care of checking TS files.
Example on Quasar: https://github.com/quasarframework/quasar-testing/blob/dev/packages/e2e-cypress/src/index.js
I see this with Cypress set up in a subdirectory, it is unable to find tsconfig.json
We see this issue when cypress imports some code from other subproject with its own tsconfig.json. I don't want to set sourcemap to false in there so it's blocking us completely from migrating to 5.x.
Place the tsconfig.json file here to override the parent folder's tsconfig.json file. https://docs.cypress.io/guides/tooling/typescript-support.html#Configure-tsconfig-json
Place the tsconfig.json file here to override the parent folder's tsconfig.json file. https://docs.cypress.io/guides/tooling/typescript-support.html#Configure-tsconfig-json
@haf we do have tsconfig in cypress folder with "sourceMap": false but it doesn't help.
Not in your repro https://github.com/IlCallo/cypress-test-tiny/tree/ts-sourcemap-conflict/cypress
I found this by googling the same problem. Then read the docs. Then I configured it like the docs say, and it started working. https://github.com/logary/logary-js/blob/master/cypress/tsconfig.json
I can recreate the issue with the repo provided. Introduced in 5.0.0.
spec.ts
it('works', () => {})
tsconfig at project root
{
"compilerOptions": {
"sourceMap": true
}
}
package.json
{
"devDependencies": {
"cypress": "^5.5.0",
"typescript": "^4.0.2"
}
}

@haf that's a minimal repro, my use case have the tsconfig as suggested by the docs, but that wasn't needed to show the broken behaviour
Look at https://www.cypress.io/blog/2019/05/13/code-create-react-app-v3-and-its-cypress-tests-using-typescript/ It helped me a lot and everything works ok
My current cypress/tsconfig.json
{
"extends": "../tsconfig.json",
"include": [
"../node_modules/cypress",
"**/*spec.ts"
],
"compilerOptions": {
"noEmit": false,
"target": "es5",
"lib": ["es5", "dom"],
"types": ["cypress"]
}
}
Thanks @unbugx! Your answer helped me to fix the issue. I had to disable sourceMap as well, though
{
"extends": "../../tsconfig.json",
"include": [
"../../node_modules/cypress",
"**/*.ts"
],
"compilerOptions": {
"noEmit": false,
"sourceMap": false,
"types": ["cypress"]
},
}
Most helpful comment
@bahmutov
Here it is: https://github.com/IlCallo/cypress-test-tiny/tree/ts-sourcemap-conflict
yarn installyarn cypress:openGiven the thumbs up to the original post, seems like I'm not the only one