NPM 和如何 运行 所有顺序命令,即使一个命令失败

NPM and How to run all sequential commands even if one command fails

我有一个 npm 脚本,其中一个命令(在本例中为 test 脚本)可能会失败。

"test": "npm run init && npm run test && npm run end"

如果 test 脚本失败,则永远不会执行 end 脚本。
有没有办法强制执行 end 脚本,即使 test 失败? 谢谢!

使用;控制运算符:

npm run init ; npm run test ; npm run end

;表示执行前面的语句,执行完后,继续执行下一条语句。