-
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: Typescript config invalid with node v22.7.0 with ESM #30099
Conversation
…d above is detected [run ci]
I'm guessing that this issue might also occur if If so, then maybe mention this in the changelog. It was introduced in Node.js 20.10.0. See https://nodejs.org/docs/latest-v20.x/api/cli.html#--experimental-detect-module. |
cypress Run #56821
Run Properties:
|
Project |
cypress
|
Branch Review |
fix/nodejs_22_7_0
|
Run status |
Passed #56821
|
Run duration | 18m 09s |
Commit |
ef6837304d: Merge branch 'develop' of github.com:cypress-io/cypress into fix/nodejs_22_7_0
|
Committer | AtofStryker |
View all properties for this run ↗︎ |
Test results | |
---|---|
Failures |
0
|
Flaky |
3
|
Pending |
210
|
Skipped |
0
|
Passing |
11113
|
View all changes introduced in this branch ↗︎ |
UI Coverage
null%
|
|
---|---|
Untested elements |
0
|
Tested elements |
0
|
Accessibility
null%
|
|
---|---|
Failed rules |
0 critical
0 serious
0 moderate
0 minor
|
Failed elements |
0
|
…n order to unit test as mocking the module seems near impossible to do correctly given the context [run ci]
@MikeMcC399 I gave this a try in5ef8ef0 |
|
|
…dule" This reverts commit 5ef8ef0.
@@ -1,5 +1,11 @@ | |||
export function hasTypeScriptInstalled (projectRoot: string) { | |||
try { | |||
// mocking this module is fairly difficult under unit test. We need to mock this for the ProjectConfigIpc unit tests | |||
// as the scaffolded projects in the data-context package do not install dependencies related to the project. | |||
if (process.env.CYPRESS_INTERNAL_MOCK_TYPESCRIPT_INSTALL === 'true') { |
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.
I couldn't figure out another way to test this. Not great, but at least gets us what we need
Released in This comment thread has been locked. If you are still experiencing this issue after upgrading to |
Additional details
Cypress with Typescript and ESM stopped working with node
22.7.0
. Based on the node release notes the--experimental-detect-module
flag is now enabled by default which doesn't play nicely with the experimental ts_node module loader that cypress is using under the hood.Turning it off via
--no-experimental-detect-module
on the child process fixes the issue.Steps to test
Unit tests added to have some coverage in the
ProjectConfigIpc
and a binary system test using node22.7.0
has been addedHow has the user experience changed?
PR Tasks
cypress-documentation
?type definitions
?