-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
fix: Resolve tsconfig.json for plugins file from the plugins directory #8377
Conversation
was erroneously passing because it wasn't written correctly
Thanks for taking the time to open a PR!
|
Test summaryRun details
View run in Cypress Dashboard ➡️ This comment has been generated by cypress-bot as a result of this project's GitHub integration settings. You can manage this integration in this project's settings in the Cypress Dashboard |
- no longer register ts-node it in the parent process, only in the child process - DRYed up resolving typescript path - added test for not registering ts-node more than once
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 IRTC (I ran the code)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The example from the original issue still fails within this PR. It is a different error however, so just want to double check if this is a separate issue. #8359 (comment)
@jennifer-shehane That error occurs because Node doesn't support the import syntax in |
"esModuleInterop": true
in cypress/tsconfig.json? #8359User facing changelog
tsconfig.json
for TypeScript projects starting from theplugins
directoryAdditional details
ts-node
resolves thetsconfig.json
starting from the current working directory (cwd
) by default. This means usingcypress/tsconfig.json
won't work to specify TypeScript config for Cypress.In reality, this only affected a couple options in
tsconfig.json
because only a couple options (e.g. "esModuleInterop", "downlevelIteration") affect the runtime. Any non-runtime options would take affect in a user's IDE because it would resolve thetsconfig.json
starting from the directory of the opened file.This PR changes it so
ts-node
will now start looking for thetsconfig.json
from the plugins directory. That iscypress/plugins
by default or thedirname
of the plugins file path if a custom one is provided. For example, if the "pluginsFile" is set to<project root>/some/other/path/to/plugins.js
, it will start looking in<project root>/some/other/path/to
.How has the user experience changed?
Users will now see runtime options in
cypress/tsconfig.json
take effect, whereas before they were ignored.PR Tasks