Testy / TestyTs

✔️ Modern TypeScript testing framework.
http://testy.github.io
ISC License
123 stars 8 forks source link

Support ES modules #98

Open tensor5 opened 2 years ago

tensor5 commented 2 years ago

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.
"
Aboisier commented 2 years ago

Hi!

Thanks for reporting this, I'll take a look at your issue next week! :)

Aboisier commented 2 years ago

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.