Silencing errors on failures for npm run-script

前端 未结 4 1689
抹茶落季
抹茶落季 2021-02-18 15:18

When you run npm test and it fails, you get the test outputs + a single error message, like so:

npm ERR! Test failed.  See above for more details.
<         


        
4条回答
  •  独厮守ぢ
    2021-02-18 16:01

    Use the npm run --silent option:

    $ npm run --silent test
    

    Even less typing if you define a shell alias:

    $ alias run='npm run --silent'
    $ run test
    

提交回复
热议问题