loopbackio / loopbackio/loopback-next
Latest loopback mocha tests are not running
まだ誰も着手していません。
- 主要言語
- TypeScript
- スター
- 5.1k
- フォーク
- 1.1k
- 平均マージ
- 2日 21時間
- マージ済み PR(30日)
- 27
説明
### Describe the bug
Create a new lb app with node 16,
Trying to run the default tests that come with lb app, using yarn test, it immediately throws this typescript error. This seems to be a mocha issue, but why did Loopback upgrade to latest mocha?
ERR_REQUIRE_ESM errors with Mocha tests.
```
const stringWidth = require('string-width');
^
Error [ERR_REQUIRE_ESM]: require() of ES Module /home/fahad/work/testapp/node_modules/string-width/index.js from /home/fahad/work/testapp/node_modules/yargs/node_modules/cliui/build/index.cjs not supported.
Instead change the require of index.js in /home/fahad/work/testapp/node_modules/yargs/node_modules/cliui/build/index.cjs to a dynamic import() which is available in all CommonJS modules.
at Object. (/home/fahad/work/testapp/node_modules/yargs/node_modules/cliui/build/index.cjs:291:21)
at Object. (/home/fahad/work/testapp/node_modules/yargs/build/index.cjs:2861:12)
at Object. (/home/fahad/work/testapp/node_modules/yargs/yargs:3:69)
at Object. (/home/fahad/work/testapp/node_modules/mocha/lib/cli/cli.js:15:15)
at Object. (/home/fahad/work/testapp/node_modules/mocha/bin/mocha.js:141:3) {
code: 'ERR_REQUIRE_ESM'
}
```
### Logs
_No response_
### Additional information
If I downgrade `yargs` library to 14.2.2, this issue is not occurring.
### Reproduction
THIS ISSUE IS OBVIOUS
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
Run yarn test in a newly created LoopBack app using Node 16 and inspect the generated test setup and dependency versions around Mocha and yargs. Done means the default Mocha tests run without the reported ERR_REQUIRE_ESM failure while retaining the intended dependency versions.
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- nodejs, typescript
- 領域
- testing-qa
- issue の種類
- バグ
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 停滞
- 明瞭さ
- 説明が足りない
- 初心者へのやさしさ
- 25/100