运行 npm 脚本时如何禁用 stdout 中的纱线错误日志

egu*_*eys 1 javascript node.js package.json yarnpkg

我在 package.json 中有一个运行测试的 npm 脚本:

"scripts": {
  "test": "tsc && node ./bin/test"
}
Run Code Online (Sandbox Code Playgroud)

我用 运行这个yarn test。我从纱线获得编译错误的输出和此日志:

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.
Run Code Online (Sandbox Code Playgroud)

有没有办法删除这个日志,因为它遮住了屏幕,我看不到编译器错误。

小智 5

yarn -s test
Run Code Online (Sandbox Code Playgroud)

此命令应静默日志,如-s纱线中的选项所示,

-s, --silent skip Yarn console logs, other types of logs (script output) will be printed
Run Code Online (Sandbox Code Playgroud)