Search code examples
javascriptnode.jsyarnpkgpackage.json

how to disable yarn error logs in stdout when running npm scripts


I have an npm script in package.json that runs tests:

"scripts": {
  "test": "tsc && node ./bin/test"
}

I run this with yarn test. I get the output of compile errors and this log from yarn:

error Command failed with exit code 2.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
error Command failed with exit code 2.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Is there a way to remove this log, because it covers up the screen, I can't see the compiler errors.


Solution

  • yarn -s test
    

    This command should silent the logs as -s option in yarn represents,

    -s, --silent skip Yarn console logs, other types of logs (script output) will be printed