1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Anuncie Aqui
    Anuncie aqui você Também: fdantas@4each.com.br

Angular 9 + CLI (TypeScript) - How to stop generating .spec.ts test files

Discussão em 'Angular' iniciado por Mohamed Kawsara, Julho 2, 2025.

  1. I know it's kind of a bad practice, but bear with me:

    I'm using Angular-CLI, particularly ng g to generate all of my classes. However, I'm not interested in any *.spec.ts test files. I know that there are two flags (--inline-template, --inline-style) to handle inline CSS and HTML instead of separated files, and for spec the --spec flag is set to true by default.

    So for each run, yes, I could do ng g c foo --it --is --spec=false.

    But how do I disable the creation of test files globally? Is there any default setting for it?

    Rashly, I did some stuff (that didn't work), like:

    ng set spec=false --global


    I also tried configuring my src/tsconfig.json by filling the exclude array:

    "exclude": [
    "**/*.spec.ts"
    ]

    Continue reading...

Compartilhe esta Página