Skip to content

missing imports from generated spec files #12778

Closed
@mina-skunk

Description

@mina-skunk

Bug, feature request, or proposal:

spec files from schematics fail

What is the expected behavior?

ng test to work out of the box after only ng generate commands

What is the current behavior?

ng test has template errors

What are the steps to reproduce?

ng new errors-schema
cd .\errors-schema\
ng add @angular/material
ng generate @angular/material:material-dashboard --name my-dashboard
ng generate @angular/material:material-nav --name my-nav
ng generate @angular/material:material-table --name my-table
ng test

for my-dashboard I had to add:
imports: [ MatGridListModule, MatMenuModule, MatIconModule, MatCardModule ],

for my-nav I had to add:
imports: [ NoopAnimationsModule, MatSidenavModule, MatToolbarModule, MatListModule, MatIconModule ],

for my-table I had to add:
imports: [ NoopAnimationsModule, MatTableModule, MatPaginatorModule, MatSortModule ],

Which versions of Angular, Material, OS, TypeScript, browsers are affected?

Angular CLI: 6.1.4
Node: 8.11.1
OS: win32 x64
Angular: 6.1.3
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.7.4
@angular-devkit/build-angular     0.7.4
@angular-devkit/build-optimizer   0.7.4
@angular-devkit/build-webpack     0.7.4
@angular-devkit/core              0.7.4
@angular-devkit/schematics        0.7.4
@angular/cdk                      6.4.6
@angular/cli                      6.1.4
@angular/material                 6.4.6
@ngtools/webpack                  6.1.4
@schematics/angular               0.7.4
@schematics/update                0.7.4
rxjs                              6.2.2
typescript                        2.7.2
webpack                           4.9.2

I can simply make pull request adding the imports to https://github.com/angular/material2/blob/master/src/lib/schematics/dashboard/files/__path__/__name%40dasherize%40if-flat__/__name%40dasherize__.component.spec.ts if desirable.

Metadata

Metadata

Assignees

Labels

P3An issue that is relevant to core functions, but does not impede progress. Important, but not urgentgood first issueThis issue is a good place to start for first time contributors to the project

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions