Generating Component without spec.ts file in Angular 2+

前端 未结 25 1050
轮回少年
轮回少年 2021-02-01 00:48

Is there a way to get rid of the spec.ts file in Angular 2+, whenever I create a new component. I know this is for testing purpose but what if I don\'t need it.

May be t

25条回答
  •  臣服心动
    2021-02-01 00:58

    Just adding this bit of information because I found myself struggling with the same issue and could not fix it by using the current answer(s), plus I did not want to make the changes on the angular-cli.json file. It appears the recent version of Angular CLI --spec=false is depreciated and therefore no longer works, use --skipTests instead.

    Test on:

    Angular CLI: 9.1.1
    Node: 12.16.1
    OS: win32 x64
    

    Your command with then be: ng g c mycomponent --skipTests instead of ng g c mycomponent --spec=false

    PS: Always test your commands using the --dry-run option to test your output.

提交回复
热议问题