DonCarleone
DonCarleone

Reputation: 839

Customizing Angular ng g c to create multiple spec files

I'd like to generate two spec files for each component, one to test the TS file and one for testing the HTML file (some might say unit testing and integration testing)

So something like this:

components
    └──credit-card
        ├── credit-card.component.css
        ├── credit-card.component.html
        ├── credit-card.component.spec.ts
        ├── credit-card.component.unit.spec.ts
        └── credit-card.component.ts

Generally, ng g c will create a spec file by default, but I'm interested in modifying the command somehow to create multiple spec files by default. Is this possible?

Upvotes: 0

Views: 1116

Answers (1)

ilia
ilia

Reputation: 138

as I know there is a VS Code extension that generates the test file in exact direction

https://marketplace.visualstudio.com/items?itemName=ThorstenRintelen.angular-spec-generator

Also, there is a clear command that you can create unit tests via commandLine https://www.npmjs.com/package/angular-unit-test-generator

Upvotes: 1

Related Questions