1

I'm running my entire project from npm scripts, and i've namespaced a few methods underneath test for clarity. I'd like to use the silent level of verbosity for all test related commands instead of the normal, extremely verbose npm ERR! Exit status 1...

Package.json

{
  "name": "test",
  "version": "0.0.0",
  "scripts": {
    "test": "npm run test:unit && npm run test:integration",
    "test:unit": "mocha test/unit",
    "test:integration": "mocha test/integration"
  }
}

I've tried including the --loglevel=silent in the npm scripts commands, but that does not work. I do not want to enable this for all commands, just for testing related ones, so setting the flag on the environment or in .npmrc is not an option (unless there is additional criteria I can define in .nmprc).

1 Answer 1

1

The flag -s can do that :

Package.json

{
  "name": "test",
  "version": "0.0.0",
  "scripts": {
    "test": "npm run test:unit -s && npm run test:integration -s",
    "test:unit": "mocha test/unit",
    "test:integration": "mocha test/integration"
  }
}

It just silences output from npm on those tasks.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.