[英]Angular - should I run production build before test or after test
If I am building a Java app for production, I'd have the build setup to build the production artefacts and then run the tests against those artefacts.如果我正在构建用于生产的 Java 应用程序,我会进行构建设置来构建生产工件,然后针对这些工件运行测试。
I've just joined an Angular project and noticed that the build is setup something like this:我刚刚加入了一个 Angular 项目,并注意到构建的设置如下:
ng test && ng lint && ng build --prod
..so its running test and lint before the actual build. ..所以它在实际构建之前运行测试和 lint。 Is the reason one might choose to do this an attempt to fail faster because the test build is quicker?人们可能选择这样做的原因是因为测试构建更快而尝试失败得更快吗? Is this standard practice in Angular apps?这是 Angular 应用程序中的标准做法吗?
The Angular tests run against the source files, the build produces a set of minified js files for deployment. Angular 测试针对源文件运行,构建生成一组缩小的 js 文件用于部署。 They are independent processes.它们是独立的进程。
The series of commands you have is effectively saying:您拥有的一系列命令实际上是在说:
if (source files passes tests && source files pass linting rules) {
produce files for deployment
}
An Angular build isn't a particularly speedy process, so it's definitely better to fail fast if tests or linting fails. Angular 构建并不是一个特别快的过程,因此如果测试或 linting 失败,最好快速失败。 You're not running tests against outdated files - if that's the thrust of your question.您没有针对过时的文件运行测试 - 如果这是您问题的重点。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.