11
5

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

npm run testするときはnpmログを切ったほうがいい

Posted at

結論

npm run test --silent

背景

vue init webpackコマンドによってプロジェクトを作成し、インストールしていくと(テスト関連のインストールを無効にしてなければ)、karmaによる単体テストとnightwatchによるE2Eテストがインストールされます。
テストはそれぞれ、npm run unitnpm run e2eで実行でき、npm run testを使うと両方連続で実行できます。

しかし、テスト結果にエラーがあると結果の後に以下のような表示がでてしまいます。

npm ERR! Windows_NT 10.0.15063
npm ERR! argv "C:\\Program Files (x86)\\Nodist\\v-x64\\8.2.1\\node.exe" "C:\\Program Files (x86)\\Nodist\\npmv\\4.0.5\\bin\\npm-cli.js" "run" "unit"
npm ERR! node v8.2.1
npm ERR! npm  v4.0.5
npm ERR! code ELIFECYCLE
npm ERR! vue@1.0.0 unit: `cross-env BABEL_ENV=test karma start test/unit/karma.conf.js --single-run`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the vue@1.0.0 unit script 'cross-env BABEL_ENV=test karma start test/unit/karma.conf.js --single-run'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the vue package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     cross-env BABEL_ENV=test karma start test/unit/karma.conf.js --single-run
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs vue
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls vue
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     C:\xampp\htdocs\vue\npm-debug.log

npm ERR! Windows_NT 10.0.15063
npm ERR! argv "C:\\Program Files (x86)\\Nodist\\v-x64\\8.2.1\\node.exe" "C:\\Program Files (x86)\\Nodist\\npmv\\4.0.5\\bin\\npm-cli.js" "run" "test"
npm ERR! node v8.2.1
npm ERR! npm  v4.0.5
npm ERR! code ELIFECYCLE
npm ERR! vue@1.0.0 test: `npm run unit && npm run e2e`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the vue@1.0.0 test script 'npm run unit && npm run e2e'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the vue package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     npm run unit && npm run e2e
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs vue
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls vue
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     C:\xampp\htdocs\vue\npm-debug.log

npm ERR!ってでてるのでシステムエラーかとも思うんですが、よく見るとテストのコマンドのところで、Exit status 1ってなっているのが原因のようです。
まあ、テスト失敗してるんだからExit status 1 でいいのではないかと思います。
そう考えると、この表示が邪魔。

そういう時は--silentオプションをつけるとnpmのログを切れます。
成功してた時に出てた余計なWARNINGとかも消えて表示がすっきりします。

11
5
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
11
5

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?