@angular/cli
generate schematics doesn't import/declare components for .spec test files.
Add scripts to scan and add import/declaration in the file.
Manual addition.
Hi @zzj0402, could you please provide a bit more information (may be also including simple examples) on this issue? Thank you.
The issue is like whenever we used to do ng generate component or ng generate service in the current version it doesn't add dependencies in spec.ts [Testing File].
Thanks for additional information @SahilShikalgar. I'm transferring this ticket to Angular CLI repo, since it's CLI-related. Thank you.
Hi @SahilShikalgar and @zzj0402 we are not understanding the issue.
Can you please provide clear description of the current and expected behaviour?
Which part of the description you don't understand?
Which dependencies do you expect to be adding in .spec.ts? Can you please provide a snippet of the incorrect code and a snippet of the expected code.
Also, kindly provide the output of ng version
Thanks.
I expect dependencies in app.modules.ts file imported to all test files. So that I don't have to do copy and paste module imports for each .spec file created.
Not by computer at moment.
Suppose my app.component.html have the following code
<div>
<app-header></app-header>
<app-body></app-body>
<app-footer></app-footer>
<div class="dropdown" ngbCollapse>
</div>
Here I'm adding using 3 child components into this. Here in spec.ts file, the declarations should be added into spec.ts automatically as we use it in HTML [using quick fix of VS Code].
In the above example in spec.ts file we need
declaration: [ HeaderComponent, FooterComponent, BodyComponent ],
imports: [ NgbBootstrap ]
In the current scenario, we manually need to add all the dependencies so we can make it automatic if possible.
Hi all, thanks for opening this feature request. However we are very cautious what features we include in the CLI as any new features will need to be given proper support. At the moment the requested feature doesn't fit in the scope of the CLI.
Thanks for your understanding and for using Angular CLI.
@alan-agius4 What is the scope you are talking about? Automatic importing doesn't fit CLI "scope"?
Which dependencies do you expect to be adding in .spec.ts? Can you please provide a snippet of the incorrect code and a snippet of the expected code.
Also, kindly provide the output of
ng versionThanks.
This is a feature request. There is nothing "incorrect".
Hi @zzj0402,
By "scope", I mean features that the tooling team wants to develop, support and maintain. Since every feature that is developed will require support and maintenance we are very cautions in which features to include.
Currently, the feature you are requesting doesn't fall in this scope.
This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
_This action has been performed automatically by a bot._