How to execute only one test spec with angular-cli

前端 未结 10 728
执笔经年
执笔经年 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条回答
  •  -上瘾入骨i
    2020-12-02 06:13

    Just small change need in test.ts file inside src folder:

    const context = require.context('./', true, /test-example\.spec\.ts$/);
    

    Here, test-example is the exact file name which we need to run

    In the same way, if you need to test the service file only you can replace the filename like "/test-example.service"

提交回复
热议问题