TestyTs
TestyTs copied to clipboard
Support ES modules
I structured my TypeScript NodeJS app as ES modules ("type": "module"
in package.json). This is the output of testyts
:
An error occured while executing the following command: /usr/bin/node <REDACTED>/node_modules/.bin/testyts. Error: "Must use import to load ES Module: <REDACTED>/src/app.spec.ts
require() of ES modules is not supported.
require() of <REDACTED>/src/app.spec.ts from <REDACTED>/node_modules/testyts/build/lib/utils/testsLoader.js is an ES module file as it is a .ts file whose nearest parent package.json contains "type": "module" which defines all .ts files in that package scope as ES modules.
Instead change the requiring code to use import(), or remove "type": "module" from <REDACTED>/package.json.
"
Hi!
Thanks for reporting this, I'll take a look at your issue next week! :)
I managed to reproduce your issue with an end to end test. I'm not sure how to fix this yet, but I'm currently exploring different solutions.