環境
- karma - v6.4.2
- mocha - 10.2.0
- webpack - 5.88.2
事象
karma start
を実行すると、以下の警告が出力される
WARNING in ./node_modules/mocha/lib/mocha.js 336:24-53
Critical dependency: the request of a dependency is an expression
@ ./node_modules/mocha/browser-entry.js 14:12-34
@ ./test/index.spec.ts 6:16-32
結論
1. テストコードにあるmocha
のインポートを消す
./test/index.spec.js
- import { describe, it } from "mocha";
+ // import { describe, it } from "mocha";
ESLint のチェックに引っかかる場合、次項もおこなう。
2. .eslintrc
を変更する
./.esrintrc.js
module.exports = {
...
overrides: [
...
{
//[test]
files: ["**/tests/**/*.spec.{j,t}s?(x)"],
env: { mocha: true },
},
...
],
};
参考
了