TestyTs icon indicating copy to clipboard operation
TestyTs copied to clipboard

Support ES modules

Open tensor5 opened this issue 2 years ago • 2 comments

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.
"

tensor5 avatar Nov 29 '21 17:11 tensor5

Hi!

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

Aboisier avatar Dec 04 '21 19:12 Aboisier

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.

Aboisier avatar Dec 11 '21 16:12 Aboisier