Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Couldn't find tsconfig.json" warning when no TypeScript in project #25335

Closed
MikeMcC399 opened this issue Jan 3, 2023 · 5 comments
Closed

Comments

@MikeMcC399
Copy link
Contributor

MikeMcC399 commented Jan 3, 2023

Current behavior

If the npm module browser-sync is installed, a warning message is displayed when Cypress is run:

"Couldn't find tsconfig.json. tsconfig-paths will be skipped"

There are however no TypeScript files involved in the test.

Installing browser-sync 2.27.11 has caused typescript 4.9.4 to be installed.

ts-warn-test@1.0.0
└─┬ browser-sync@2.27.11
  └─┬ browser-sync-client@2.27.11
    └── typescript@4.9.4

On GitHub ubuntu-22.04 runner

Without DEBUG enabled, the log file shows:

Opening Cypress...
...
Couldn't find tsconfig.json. tsconfig-paths will be skipped

With DEBUG enabled, the log file shows:

cypress:lifecycle:ProjectConfigIpc found typescript in /home/runner/work/ts-warn-test/ts-warn-test/tests/cy-with-browser-sync
cypress:lifecycle:ProjectConfigIpc using cjs with --require /home/runner/.cache/Cypress/12.2.0/Cypress/resources/app/node_modules/@packages/server/lib/plugins/child/register_ts_node.js
cypress:lifecycle:ProjectConfigIpc trigger the load of the file
cypress:server:register-ts-node executing register_ts_node with args { _: [ '/opt/hostedtoolcache/node/18.12.1/x64/bin/node', '/home/runner/.cache/Cypress/12.2.0/Cypress/resources/app/node_modules/@packages/server/lib/plugins/child/require_async_child.js' ], projectRoot: '/home/runner/work/ts-warn-test/ts-warn-test/tests/cy-with-browser-sync', file: '/home/runner/work/ts-warn-test/ts-warn-test/tests/cy-with-browser-sync/cypress.config.js' }
cypress:server:register-ts-node registering ts-node for projectRoot: /home/runner/work/ts-warn-test/ts-warn-test/tests/cy-with-browser-sync and file: /home/runner/work/ts-warn-test/ts-warn-test/tests/cy-with-browser-sync/cypress.config.js
cypress:server:ts-node projectRoot path: /home/runner/work/ts-warn-test/ts-warn-test/tests/cy-with-browser-sync
cypress:server:ts-node registeredFile: /home/runner/work/ts-warn-test/ts-warn-test/tests/cy-with-browser-sync/cypress.config.js
cypress:server:plugins resolving typescript with projectRoot '/home/runner/work/ts-warn-test/ts-warn-test/tests/cy-with-browser-sync'
cypress:server:plugins resolved typescript /home/runner/work/ts-warn-test/ts-warn-test/tests/cy-with-browser-sync/node_modules/typescript/lib/typescript.js
cypress:server:ts-node typescript path: /home/runner/work/ts-warn-test/ts-warn-test/tests/cy-with-browser-sync/node_modules/typescript/lib/typescript.js
cypress:server:ts-node registering project TS with options { compiler: '/home/runner/work/ts-warn-test/ts-warn-test/tests/cy-with-browser-sync/node_modules/typescript/lib/typescript.js', compilerOptions: { module: 'commonjs', preserveValueImports: false }, dir: '/home/runner/work/ts-warn-test/ts-warn-test/tests/cy-with-browser-sync', transpileOnly: true }
Couldn't find tsconfig.json. tsconfig-paths will be skipped

Run locally Ubuntu 22.04

On Ubuntu 22.04 run locally

cd tests/cy-with-browser-sync
npx cypress run

no warning is output, unless

export DEBUG=cypress:*

is set, in which case the warning
"Couldn't find tsconfig.json. tsconfig-paths will be skipped"
is found in the debug logs.

Run locally Windows 11

On Windows 11 run locally

cd tests/cy-with-browser-sync
npx cypress run

the warning
"Couldn't find tsconfig.json. tsconfig-paths will be skipped"
is output.

Desired behavior

Installing browser-sync without any TypeScript files (*.ts, *.tsx) should not cause a warning message to appear when Cypress is run.

Test code to reproduce

See repository https://github.com/MikeMcC399/ts-warn-test (Edit: now archived.)

Workflows:

Or clone the repository and run

cd tests/cy-with-browser-sync
npx cypress run

Cypress Version

12.2.0
(not resolved in Cypress 12.8.1)

Node version

16.13.0 for GitHub runner using cypress-io/github-action
(now 16.16.0)

Operating System

ubuntu-22.04

Debug Logs

especially

https://github.com/MikeMcC399/ts-warn-test/blob/59c204bdd854cc69410ef0af683cac91a5d0fbf6/logs/3_Cypress%20run.txt#L116-L124

Other

It is not the same issue though, because in this issue a project is described which is not using TypeScript at all.

@MikeMcC399
Copy link
Contributor Author

There was a suggestion in #22273 (comment) from @segevfiner that the issue might be resolved by upgrading

"tsconfig-paths": "3.10.1",

to use v4.

@astone123
Copy link
Contributor

Thanks @MikeMcC399, looks like we just need to upgrade tsconfig-paths to v4. Routing this to the e2e team

@MikeMcC399
Copy link
Contributor Author

MikeMcC399 commented Feb 9, 2023

I updated the repo https://github.com/MikeMcC399/ts-warn-test, which demonstrates the issue, to Cypress 12.5.1.

The warning message
"Couldn't find tsconfig.json. tsconfig-paths will be skipped"
is still shown.

I cannot yet see any qualification of this issue from the https://github.com/cypress-io/cypress/labels/routed-to-e2e team.

Edit: I also confirmed that it is still reproducible on Cypress 12.8.1.

@MikeMcC399
Copy link
Contributor Author

@astone123

looks like we just need to upgrade tsconfig-paths to v4. Routing this to the e2e team

Thanks very much for your assessment! We didn't hear anything back from the e2e team so far. I guess they are overloaded!?

@MikeMcC399
Copy link
Contributor Author

This issue is no longer reproducible with browser-sync 2.29.1 due to the removal of "typescript": "^4.6.2" from dependencies in browser-sync (see comments in BrowserSync/browser-sync#2029), so I will close the issue.

The other related open issues continue to warrant investigation and resolution:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants