Open GeorgeXCV opened 2 years ago
To follow our original discussion, and give an update since it's been a while since then
... three things to try:
- try out using configuration to always transform to ESM
- .mts extension
- esm flag
esbuild
works pretty well for our projects, although to support require()
and friends, you need a custom banner
configurationI had the same issue, due to the del
import on my cypress.config.ts file, and using the fs.unlink
snipped has fixed it for me.
thanks a lot for digging into it
I had the same issue after upgrading TypeScript to 5.4.5.
export DEBUG=cypress:*
Revealed the underlying issue - it was ts-node
not being able to load "extends": "@foo/tsconfig"
but only "extends": "./path/to/foo/tsconfig.json"
. This issue was fixed in ts-node 10.9.2 but my current version of Cypress uses 10.9.1. I changed the extends to a relative path as a workaround.
Current behavior
If I use the code from the snippet here for TypeScript it breaks the project:
Even just this line breaks the project:
const del = require('del')
Desired behavior
I can run my tests and the videos are deleted if test passed.
Test code to reproduce
Cypress Version
10.1.0
Other
Current snippet also isn't 100% TypeScript/Eslint friendly because uses
require
instead ofimport
and has unused parameter. Something like this should work right?