简体   繁体   中英

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?

Recently i moved my Angular 4 cli application into Nx work space. Previously i used fdescribe to achieve this functionality.
So please suggest me if there is any option to do this in Nx work space?

这对我有用

 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.

Note: I'm using not the latest version ( "@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>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM