Unknown file extension ".ts" for
OmgImAlexis opened this issue · comments
Alexis Tyler commented
Description
While trying to use esno with typescript I'm getting stuck on an error.
Package version
japa 0.14.1
Error Message & Stack Trace
❯ esno .\bin\test.ts
Unknown file extension ".ts" for C:\Users\xo\code\omgimalexis\scratch-pad\tests\maths.spec.ts
at async importFiles C:/Users/xo/code/omgimalexis\scratch-pad/node_modules/@japa/runner/build/index.js:241
236| if (isFileAllowed(file, runnerOptions.filters.files)) {
237| await runnerOptions.importer(file);
238| }
239| }
240| else {
> 241| await runnerOptions.importer(file);
242| }
243| }
244| }
245| /**
246| * Run japa tests
Relevant Information
I needed to apply the fix from #2 first.
Alexis Tyler commented
Seems using esmo
solves the issue though I do get the experimental loader warning which I'm hoping we can supress?
❯ esmo .\bin\test.ts
(node:40156) ExperimentalWarning: --experimental-loader is an experimental feature. This feature could change at any time
(Use `node --trace-warnings ...` to show where the warning was created)
(node:40156) DeprecationWarning: Obsolete loader hook(s) supplied and will be ignored: getFormat, transformSource
Maths.add (tests\maths.spec.ts)
√ add two numbers (2ms)
PASSED
total : 1
passed : 1
duration : 6ms
Alexis Tyler commented
Actually this doesn't fix the issue since I now can't mock dependencies since everything is being imported as an ES module.
ES Modules cannot be stubbed
Harminder Virk commented
Seems more like an issue to be reported with Esmo. Japa itself is not registering any loader hooks with Node.js. https://github.com/antfu/esno/issues/21