[英]how can i run a specific angular spec test file in NX workspace?
is there any way to run an specific angular spec test file in Nx work space?有没有办法在 Nx 工作空间中运行特定的 angular 规范测试文件?
Recently i moved my Angular 4 cli application into Nx work space.最近我将我的 Angular 4 cli 应用程序移动到 Nx 工作空间。 Previously i used fdescribe to achieve this functionality.
以前我使用fdescribe来实现这个功能。
So please suggest me if there is any option to do this in Nx work space?所以请建议我是否可以在 Nx 工作空间中执行此操作?
这对我有用
nx test --test-file example.spec.ts
这与我们为单个应用程序执行的方式相同,但请注意,您应该使用 --app='your-app-name' 和 ng test,因此最终命令如下所示,
ng test --app='app1'
For me the watch tag did the magic:对我来说,手表标签起到了神奇的作用:
ng test --watch
Before running through everything it offered me the following options:在运行所有内容之前,它为我提供了以下选项:
› Press a to run all tests.
› Press f to run only failed tests.
› Press p to filter by a filename regex pattern.
› Press t to filter by a test name regex pattern.
› Press q to quit watch mode.
› Press Enter to trigger a test run.
Selecting the 'p' option and typing xy.service.spec.ts
worked fine.选择“p”选项并输入
xy.service.spec.ts
工作正常。
Note: I'm using not the latest version ( "@nrwl/nx": "7.4.0"
)注意:我使用的不是最新版本(
"@nrwl/nx": "7.4.0"
)
这对我有用:
nx run <project-name>:test --testFile=<file-name>
this worked for me:这对我有用:
nx run <project-name>:test --testFile <filename.spec.ts>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.