Generate .spec files for already existing components / services

See original GitHub issue

Solution

If you look for right now solution please follow ngx-spec.

Bug Report or Feature Request (mark with an x)

- [ ] bug report -> please search issues before submitting
- [x] feature request

Versions.

@angular/cli: 1.4.2 node: 8.1.3 os: darwin x64 @angular/animations: 4.3.6 @angular/common: 4.3.6 @angular/compiler: 4.3.6 @angular/core: 4.3.6 @angular/forms: 4.3.6 @angular/http: 4.3.6 @angular/platform-browser: 4.3.6 @angular/platform-browser-dynamic: 4.3.6 @angular/router: 4.3.6 @angular/cli: 1.4.2 @angular/compiler-cli: 4.3.6 typescript: 2.4.2

Repro steps.

The log given by the failure.

Desired functionality.

I want to generate a .spec file for already existing component / service that does not have a spec yet / has an outdated spec. More on the usecase https://stackoverflow.com/q/46276055/1990451

Mention any other details that might be useful.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:117
  • Comments:55 (6 by maintainers)

github_iconTop GitHub Comments

59reactions
smnbbrvcommented, May 18, 2018

I created a pull request implementing the feature https://github.com/angular/devkit/pull/938 .

Allows to create specs for component, directive, module, service, pipe, guard (based on corresponding schematics) by running

ng g spec my-component.component

or as a file (more convenient because files normally already exist and it is easier to point to the file)

ng g spec /my/project/app/src/blah/my-component.component.ts

Please review.

48reactions
frontEndExpertcommented, Nov 26, 2017

Yes generating a spec file after we already generated our component and modified it. ng g component your-component --spec-only

Read more comments on GitHub >

github_iconTop Results From Across the Web

Angular CLI create .spec files for already existing components
However sometimes I would like to have an option to generate / recreate the corresponding *.spec file for an already existing component / ......
Read more >
Angular spec generator - Visual Studio Marketplace
Select an Angular *.ts file and use right click to generate the spec file. Generate spec (jest / jasmine / mockito / empty)...
Read more >
13. Create Spec file for Posts Component to do Isolated Unit ...
In this video we will see how to Create Spec file for Posts Component to do Isolated Unit Test for a component -...
Read more >
generate spec files for already existing components
To create a catalog from an existing catalog In the Spec Editor, click File menuNewNew Catalog From Existing. Enter the Source Catalog name...
Read more >
Angular-spec-generator - npm.io
choice directory which you want to generate spec, and then it will generate all Angular spec. only generate file when spec file not...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found