📒

Jest で NODE_ENV value of 'test' did not match any deployment...の対応

2022/12/09に公開

Jest で npm testコマンドでテスト実行したときに、次のwarningが出た場合の対応方法です。

WARNING: NODE_ENV value of 'test' did not match any deployment config file names.

解消法

package.json の scripts に以下のように記述します。

  ...
  "scripts": {
    "test": "NODE_ENV= jest",
    ...
  },
  ...
  • NODE_ENV=jest の間にはスペースが入ります。

参考

https://github.com/node-config/node-config/issues/386

Discussion