dojo / cli-test-intern

:rocket: Dojo - cli command for testing applications
http://dojo.io
Other
2 stars 19 forks source link

Throw errors "Cannot find module 'customWidget/CustomWidget'" when installed widget only contains .mjs file #133

Open xiaohulu opened 5 years ago

xiaohulu commented 5 years ago

Bug

Package Version: v6.0

  1. Create an app project and a widget project, both modern(.mjs)
  2. Build widget project to generate .mjs output
  3. Run npm run build form app project, success
  4. But, when run npm run test, throw errors
Error: Cannot find module 'customWidget/CustomWidget'
  at Function.Module._resolveFilename  <internal\modules\cjs\loader.js:581:15>
  at Function.Module._load  <internal\modules\cjs\loader.js:507:25>
  at Module.require  <internal\modules\cjs\loader.js:637:17>
  at require  <internal\modules\cjs\helpers.js:22:18>
  at <src\widgets\Header.tsx:2:1>
  at <src\widgets\Header.tsx:3:17>
  at Object.<anonymous>  <src\widgets\Header.tsx:9:3>
  at Module._compile  <internal\modules\cjs\loader.js:689:30>
  at Module.m._compile  <node_modules\@dojo\cli-test-intern\node_modules\ts-node\src\index.ts:422:23>
  at Module._extensions..js  <internal\modules\cjs\loader.js:700:10>

The cli-test-intern NOT found the .mjs file, but the file exists. Then I try build the widget with --legacy, put the .js file to the node_modules/customWidget/, And run npm run test again, tests all passed.

So I think cli-test-intern may not found .mjs correctly.