0

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?

0

1 Answer 1

1

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

Sign up to request clarification or add additional context in comments.

2 Comments

Thanks. This is useful information, but I'm wondering if there's a way to customize n g c behavior to change how man spec files are created without installing more software.
Would you be able to upvote so that this question can potentially get more reach?

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.