如何在每次构建之前使测试套件 运行?
How to make the test suite run before each build?
目前我的工作流程是 运行 npm test
在 运行 npm build
.
之前
有没有办法将测试命令集成到构建命令中,以便我每次构建时自动测试运行?
package.json:
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
给你一个解决方案
"scripts": {
"start": "react-scripts start",
"build": "react-scripts test && react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
}
您可以使用 && 运算符将两个步骤合二为一。每次你 运行 npm build
首先它会 运行 测试用例然后构建会发生
目前我的工作流程是 运行 npm test
在 运行 npm build
.
有没有办法将测试命令集成到构建命令中,以便我每次构建时自动测试运行?
package.json:
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
给你一个解决方案
"scripts": {
"start": "react-scripts start",
"build": "react-scripts test && react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
}
您可以使用 && 运算符将两个步骤合二为一。每次你 运行 npm build
首先它会 运行 测试用例然后构建会发生