How to execute only one test spec with angular-cli

前端 未结 10 748
执笔经年
执笔经年 2020-12-02 06:00

I have Angular2 project build with Angular-CLI (beta 20).

Is there a way to run tests against only one selected spec file?

I used to have a project based on

10条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-02 06:14

    This worked for me in every case:

    ng test --include='**/dealer.service.spec.ts'
    

    However, I usually got "TypeError: Cannot read property 'ngModule' of null" for this:

    ng test --main src/app/services/dealer.service.spec.ts
    

    Version of @angular/cli 10.0.4

提交回复
热议问题