テスト実行中にnpmエラーELIFECYCLEが発生する 質問する

テスト実行中にnpmエラーELIFECYCLEが発生する 質問する

私はユニット テストに mocha-phantomjs セットアップを使用しています。テストを実行するには、次の package.json scriot を使用します。

"scripts": {
"test": "npm run testFlickr",
"testFlickr": "mocha-phantomjs ./test/FlickrTest.html" 
}

これはブラウザでは問題なく動作します。そして、コマンドをnpm testcmdで実行すると、テストは正常に実行されますが、次のエラーも表示されます。

3 passing (5s)
6 failing


npm ERR! flickr-test@ testFlickr: `mocha-phantomjs ./test/FlickrTest.html`
npm ERR! Exit status 6
npm ERR!
npm ERR! Failed at the flickr-test@ testFlickr script.
npm ERR! This is most likely a problem with the flickr-test package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     mocha-phantomjs ./test/FlickrTest.html
npm ERR! You can get their info via:
npm ERR!     npm owner ls flickr-test
npm ERR! There is likely additional logging output above.
npm ERR! System Windows_NT 6.1.7600
npm ERR! command "C:\\Program Files\\nodejs\\\\node.exe" "C:\\Program Files\\nod
ejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "testFlickr"
npm ERR! cwd C:\Users\user\Desktop\test
npm ERR! node -v v0.10.26
npm ERR! npm -v 1.4.3
npm ERR! code ELIFECYCLE
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR!     C:\Users\user\Desktop\test\npm-debug.log
npm ERR! not ok code 0
npm ERR! Test failed.  See above for more details.
npm ERR! not ok code 0

このエラーを解決する方法を教えてください。

ベストアンサー1

私も同じ問題を抱えていましたが、ユニットテストを実行するときに次のようにすることで解決しました。ない使用

npm run test

代わりに以下を使用してください:

npm test

おすすめ記事