3

I was creating the Angular component with --spec=false but now I need to do unit test, is there a way to create only spec.ts files with Angular CLI?

deleting
  • 429
  • 1
  • 8
  • 19
  • 1
    dont think you have special command for this, but it very easy to add such file manually – happyZZR1400 Feb 05 '18 at 11:54
  • Yes I can do it manually, but I want to know if there is a command for this... =D – deleting Feb 05 '18 at 11:55
  • Possible duplicate of [Angular CLI create .spec files for already existing components](https://stackoverflow.com/questions/46276055/angular-cli-create-spec-files-for-already-existing-components) – Artem S. Aug 01 '18 at 19:50

2 Answers2

4

Currently, Angular CLI does not provide this functionality. However, you can make a pull request to the @angular/cli team to integrate your idea, and if the code works and the idea seems good enough, they might add it.

Or, you can use SimonTest is an extension to VS Code that generates tests for existing files.

2

According to this Feature Request, it has not been implemented at this time. I think you have to do it by hand for now.

Benjamin Schäublin
  • 1,526
  • 1
  • 16
  • 26