How to execute only one test spec with angular-cli

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

    Configure test.ts file inside src folder:

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

    Replace /\.spec\.ts$/ with the file name you want to test. For example: /app.component\.spec\.ts$/

    This will run test only for app.component.spec.ts.

提交回复
热议问题