Files
cypress/packages/server/index.js
Bill Glesias 9b3b023aa0 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.
2025-04-29 13:31:28 -04:00

34 lines
880 B
JavaScript

const runChildProcess = async (entryPoint) => {
require('tsx/cjs')
require(entryPoint)
}
const startCypress = async () => {
try {
const { initializeStartTime } = require('./lib/util/performance_benchmark')
initializeStartTime()
// No typescript requires before this point please
// typescript isn't interpreted until the start cypress file
// Avoid putting much code here all together since this is prior to v8 snapshots.
const { hookRequire } = require('./hook-require')
hookRequire({ forceTypeScript: false })
await require('./start-cypress')
} catch (error) {
// eslint-disable-next-line no-console
console.error(error)
process.exit(1)
}
}
const { entryPoint } = require('minimist')(process.argv.slice(1))
if (entryPoint) {
module.exports = runChildProcess(entryPoint)
} else {
module.exports = startCypress()
}