Qiita Teams that are logged in
You are not logged in to any team

Log in to Qiita Team
Community
OrganizationAdvent CalendarQiitadon (β)
Service
Qiita JobsQiita ZineQiita Blog
5
Help us understand the problem. What is going on with this article?
@frost_star

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

More than 3 years have passed since last update.

結論

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とかも消えて表示がすっきりします。

5
Help us understand the problem. What is going on with this article?
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
frost_star
まだまだ半人前プログラマー。

Comments

No comments
Sign up for free and join this conversation.
Sign Up
If you already have a Qiita account Login
5
Help us understand the problem. What is going on with this article?