How to execute only one test spec with angular-cli

前端 未结 10 669
执笔经年
执笔经年 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:12

    Each of your .spec.ts file have all its tests grouped in describe block like this:

    describe('SomeComponent', () => {...}

    You can easily run just this single block, by prefixing the describe function name with f:

    fdescribe('SomeComponent', () => {...}

    If you have such function, no other describe blocks will run. Btw. you can do similar thing with it => fit and there is also a "blacklist" version - x. So:

    • fdescribe and fit causes only functions marked this way to run
    • xdescribe and xit causes all but functions marked this way to run

提交回复
热议问题