You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: replace ts-node with tsx for parsing user configuration (#31520)
* feat: replace tsnode with tsx for parsing user configuration in all cases
* bump ubuntu images from node 18 to 20 as node 18 is not supported in cypress 15 and allows us to not include the 18.19.0 workaround to use --import with tsx inside the ProjectConfigIpc
* fix: issues finding tsx on windows as it needs the file:// protocol as absolute drive paths are not recognized as a file protocol in the node context
* make sure to filter out stack code correctly for windows
* fix: fix flake from windows on reporter menu not expanding (unrelated to this PR and should be merged into develop)
* chore: update changelog with all issues tsx cutover closes
* fix merge conflicts
* chore: add regression tests for cypress projects that previously did not work but now do with tsx
* build all binaries
* chore: address issues from code review
* update changelog
* remove todo comment on testing legacy migration with tsx
* refactor codeFrame calculation into a util function and add a unit test
* updated node versions in project config ipc tests to remove 18 and test threshold / latest values. Removed redundant comments on ts-node.
- Removed support for [Chrome DevTools Protocol](https://chromedevtools.github.io/devtools-protocol) with the [firefox](https://www.mozilla.org/) browser. Addresses [#31189](https://github.com/cypress-io/cypress/issues/31189).
11
11
- The Cypress configuration wizard for Component Testing supports TypeScript 5.0 or greater. Addresses [#31187](https://github.com/cypress-io/cypress/issues/31187).
12
12
13
+
**Features:**
14
+
15
+
- [`tsx`](https://tsx.is/) is now used in all cases to run the Cypress config, replacing [ts-node](https://github.com/TypeStrong/ts-node) for TypeScript and Node for commonjs/ESM. This should allow for more interoperability for users who are using any variant of ES Modules. Addresses [#8090](https://github.com/cypress-io/cypress/issues/8090), [#15724](https://github.com/cypress-io/cypress/issues/15724), [#21805](https://github.com/cypress-io/cypress/issues/21805), [#22273](https://github.com/cypress-io/cypress/issues/22273), [#22747](https://github.com/cypress-io/cypress/issues/22747), [#23141](https://github.com/cypress-io/cypress/issues/23141), [#25958](https://github.com/cypress-io/cypress/issues/25958), [#25959](https://github.com/cypress-io/cypress/issues/25959), [#26606](https://github.com/cypress-io/cypress/issues/26606), [#27359](https://github.com/cypress-io/cypress/issues/27359), [#27450](https://github.com/cypress-io/cypress/issues/27450), [#28442](https://github.com/cypress-io/cypress/issues/28442), [#30318](https://github.com/cypress-io/cypress/issues/30318), [#30718](https://github.com/cypress-io/cypress/issues/30718), [#30907](https://github.com/cypress-io/cypress/issues/30907), [#30915](https://github.com/cypress-io/cypress/issues/30915), [#30925](https://github.com/cypress-io/cypress/issues/30925), [#30954](https://github.com/cypress-io/cypress/issues/30954) and [#31185](https://github.com/cypress-io/cypress/issues/31185).
cy.log('should not contain the link if you navigate away and back')
654
+
// A bit of a hack, but our cy-in-cy test needs to wait for the reporter to fully render before pressing the "f" key to expand the "Search specs" menu.
655
+
// Otherwise, the "f" keypress happens before the event is registered, which causes the "Search Specs" menu to not expand.
// NOTE: The IDE in which you are working likely will not let attach to this process until it is running if using the --inspect option
281
+
// If needing to debug the child process (webpack-dev-server/vite-dev-server/webpack-preprocessor(s)/config loading), you may want to use --inspect-brk instead
282
+
// as it will NOT execute that process until you attach the debugger to it.
282
283
.push(`--inspect=${process.debugPort+1}`)
283
284
.value()
284
285
}
285
286
286
-
debug('fork child process %o',{CHILD_PROCESS_FILE_PATH, configProcessArgs,childOptions: _.omit(childOptions,'env')})
287
-
288
-
letisProjectUsingESModules=false
287
+
/**
288
+
* Before the introduction of tsx, Cypress used ts-node (@see https://github.com/TypeStrong/ts-node) with native node to try and load the user's cypress.config.ts file.
289
+
* This presented problems because the Cypress node runtime runs in commonjs, which may not be compatible with the user's cypress.config.ts and tsconfig.json.
290
+
* To mitigate the aforementioned runtime incompatibility, we used to force TypeScript options for the user in order to load their config inside the our node context
291
+
* via a child process, which lead to clashes and issues (outlined in the comments below).
292
+
* This is best explained historically in our docs which a screenshot can be see in @see https://github.com/cypress-io/cypress/issues/30426#issuecomment-2805204540 and can be seen
293
+
* in an older version of the Cypress codebase (@see https://github.com/cypress-io/cypress/blob/v14.3.0/packages/server/lib/plugins/child/ts_node.js#L24)
294
+
*
295
+
* Attempted workarounds with ts-node and node: @see https://github.com/cypress-io/cypress/pull/28709
296
+
* Example continued end user issues: @see https://github.com/cypress-io/cypress/issues/30954 and @see https://github.com/cypress-io/cypress/issues/30925
297
+
* Spike into ts-node alternatives (a lot of useful comments on tsx): @see https://github.com/cypress-io/cypress/issues/30426
298
+
* feature issue to replace ts-node as our end user TypeScript loader: @see https://github.com/cypress-io/cypress/issues/31185
299
+
*
300
+
* tsx (@see https://tsx.is/) is able to work with both CommonJS and ESM at the same time ( @see https://tsx.is/#seamless-cjs-%E2%86%94-esm-imports), which solves the problem of interoperability that
301
+
* Cypress faced with ts-node and really just node itself. We no longer need experimental node flags and ts-node permutations to load the user's config file.
302
+
* We can use tsx to load just about anything, including JavaScript files (@see https://github.com/privatenumber/ts-runtime-comparison)!
0 commit comments