-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Description
Describe the bug
After creating a new project using "dotnet new angular", there are jasmine spec failures.
To Reproduce
Run attached script (create-problem.bat). This script creates a new solution with a webapi/angular project, builds the solution, and then runs 'ng test'
You should see a handful of spec failures in LoginMenuComponent, AuthorizeGuard, LogoutComponent. (see spec-failure-details.txt)
AuthorizeGuard > should ...
NullInjectorError: StaticInjectorError(DynamicTestModule)[AuthorizeGuard -> Router]:
StaticInjectorError(Platform: core)[AuthorizeGuard -> Router]:
NullInjectorError: No provider for Router!
error properties: Object({ ngTempTokenPath: null, ngTokenPath: [ 'AuthorizeGuard', Function ] })
at
at NullInjector.get (http://localhost:9876/_karma_webpack_/node_modules/@angular/core/fesm2015/core.js:855:1)
at resolveToken (http://localhost:9876/_karma_webpack_/node_modules/@angular/core/fesm2015/core.js:17514:1)
at tryResolveToken (http://localhost:9876/_karma_webpack_/node_modules/@angular/core/fesm2015/core.js:17440:1)
at StaticInjector.get (http://localhost:9876/_karma_webpack_/node_modules/@angular/core/fesm2015/core.js:17266:1)
at resolveToken (http://localhost:9876/_karma_webpack_/node_modules/@angular/core/fesm2015/core.js:17514:1)
at tryResolveToken (http://localhost:9876/_karma_webpack_/node_modules/@angular/core/fesm2015/core.js:17440:1)
at StaticInjector.get (http://localhost:9876/_karma_webpack_/node_modules/@angular/core/fesm2015/core.js:17266:1)
at resolveNgModuleDep (http://localhost:9876/_karma_webpack_/node_modules/@angular/core/fesm2015/core.js:30393:1)
at createClass (http://localhost:9876/_karma_webpack_/node_modules/@angular/core/fesm2015/core.js:30463:1)
at createProviderInstance (http://localhost:9876/_karma_webpack_/node_modules/@angular/core/fesm2015/core.js:30426:1)
LogoutComponent > should create
NullInjectorError: StaticInjectorError(DynamicTestModule)[LogoutComponent -> ActivatedRoute]:
StaticInjectorError(Platform: core)[LogoutComponent -> ActivatedRoute]:
NullInjectorError: No provider for ActivatedRoute!
error properties: Object({ ngTempTokenPath: null, ngTokenPath: [ 'LogoutComponent', Function ], ngDebugContext: DebugContext({ view: Object({ def: Object({ factory: Function, nodeFlags: 33669121, rootNodeFlags: 33554433, nodeMatchedQueries: 0, flags: 0, nodes: [ Object({ nodeIndex: 0, parent: null, renderParent: null, bindingIndex: 0, outputIndex: 0, checkIndex: 0, flags: 33554433, childFlags: 114688, directChildFlags: 114688, childMatchedQueries: 0, matchedQueries: Object({ }), matchedQueryIds: 0, references: Object({ }), ngContentIndex: null, childCount: 1, bindings: [ ], bindingFlags: 0, outputs: [ ], element: Object({ ns: '', name: 'app-logout', attrs: [ ], template: null, componentProvider: Object({ nodeIndex: 1, parent: , renderParent: , bindingIndex: 0, outputIndex: 0, checkIndex: 1, flags: 114688, childFlags: 0, directChildFlags: 0, childMatchedQueries: 0, matchedQueries: Object, matchedQueryIds: 0, references: Object, ngContentIndex ...
at
at NullInjector.get (http://localhost:9876/karma_webpack/node_modules/@angular/core/fesm2015/core.js:855:1)
at resolveToken (http://localhost:9876/karma_webpack/node_modules/@angular/core/fesm2015/core.js:17514:1)
at tryResolveToken (http://localhost:9876/karma_webpack/node_modules/@angular/core/fesm2015/core.js:17440:1)
at StaticInjector.get (http://localhost:9876/karma_webpack/node_modules/@angular/core/fesm2015/core.js:17266:1)
at resolveToken (http://localhost:9876/karma_webpack/node_modules/@angular/core/fesm2015/core.js:17514:1)
at tryResolveToken (http://localhost:9876/karma_webpack/node_modules/@angular/core/fesm2015/core.js:17440:1)
at StaticInjector.get (http://localhost:9876/karma_webpack/node_modules/@angular/core/fesm2015/core.js:17266:1)
at resolveNgModuleDep (http://localhost:9876/karma_webpack/node_modules/@angular/core/fesm2015/core.js:30393:1)
at NgModuleRef.get (http://localhost:9876/karma_webpack/node_modules/@angular/core/fesm2015/core.js:31578:1)
at resolveDep (http://localhost:9876/karma_webpack/node_modules/@angular/core/fesm2015/core.js:32143:1)
Expected undefined to be truthy.
Error: Expected undefined to be truthy.
at
at UserContext. (http://localhost:9876/karma_webpack/src/api-authorization/logout/logout.component.spec.ts:23:23)
at ZoneDelegate.invoke (http://localhost:9876/karma_webpack/node_modules/zone.js/dist/zone-evergreen.js:359:1)
at ProxyZoneSpec.push../node_modules/zone.js/dist/zone-testing.js.ProxyZoneSpec.onInvoke (http://localhost:9876/karma_webpack/node_modules/zone.js/dist/zone-testing.js:308:1)
LoginComponent > should create
NullInjectorError: StaticInjectorError(DynamicTestModule)[LoginComponent -> ActivatedRoute]:
StaticInjectorError(Platform: core)[LoginComponent -> ActivatedRoute]:
NullInjectorError: No provider for ActivatedRoute!
error properties: Object({ ngTempTokenPath: null, ngTokenPath: [ 'LoginComponent', Function ], ngDebugContext: DebugContext_({ view: Object({ def: Object({ factory: Function, nodeFlags: 33669121, rootNodeFlags: 33554433, nodeMatchedQueries: 0, flags: 0, nodes: [ Object({ nodeIndex: 0, parent: null, renderParent: null, bindingIndex: 0, outputIndex: 0, checkIndex: 0, flags: 33554433, childFlags: 114688, directChildFlags: 114688, childMatchedQueries: 0, matchedQueries: Object({ }), matchedQueryIds: 0, references: Object({ }), ngContentIndex: null, childCount: 1, bindings: [ ], bindingFlags: 0, outputs: [ ], element: Object({ ns: '', name: 'app-login', attrs: [ ], template: null, componentProvider: Object({ nodeIndex: 1, parent: , renderParent: , bindingIndex: 0, outputIndex: 0, checkIndex: 1, flags: 114688, childFlags: 0, directChildFlags: 0, childMatchedQueries: 0, matchedQueries: Object, matchedQueryIds: 0, references: Object, ngContentIndex: ...
at
at NullInjector.get (http://localhost:9876/karma_webpack/node_modules/@angular/core/fesm2015/core.js:855:1)
at resolveToken (http://localhost:9876/karma_webpack/node_modules/@angular/core/fesm2015/core.js:17514:1)
at tryResolveToken (http://localhost:9876/karma_webpack/node_modules/@angular/core/fesm2015/core.js:17440:1)
at StaticInjector.get (http://localhost:9876/karma_webpack/node_modules/@angular/core/fesm2015/core.js:17266:1)
at resolveToken (http://localhost:9876/karma_webpack/node_modules/@angular/core/fesm2015/core.js:17514:1)
at tryResolveToken (http://localhost:9876/karma_webpack/node_modules/@angular/core/fesm2015/core.js:17440:1)
at StaticInjector.get (http://localhost:9876/karma_webpack/node_modules/@angular/core/fesm2015/core.js:17266:1)
at resolveNgModuleDep (http://localhost:9876/karma_webpack/node_modules/@angular/core/fesm2015/core.js:30393:1)
at NgModuleRef_.get (http://localhost:9876/karma_webpack/node_modules/@angular/core/fesm2015/core.js:31578:1)
at resolveDep (http://localhost:9876/karma_webpack/node_modules/@angular/core/fesm2015/core.js:32143:1)
Expected undefined to be truthy.
Error: Expected undefined to be truthy.
at
at UserContext. (http://localhost:9876/karma_webpack/src/api-authorization/login/login.component.spec.ts:23:23)
at ZoneDelegate.invoke (http://localhost:9876/karma_webpack/node_modules/zone.js/dist/zone-evergreen.js:359:1)
at ProxyZoneSpec.push../node_modules/zone.js/dist/zone-testing.js.ProxyZoneSpec.onInvoke (http://localhost:9876/karma_webpack/node_modules/zone.js/dist/zone-testing.js:308:1)
LoginMenuComponent > should create
Failed: Template parse errors:
Can't bind to 'routerLink' since it isn't a known property of 'a'. ("*ngIf="isAuthenticated | async">
<a class="nav-link text-dark" [ERROR ->][routerLink]='["/authentication/profile"]' title="Manage">Hello {{ userName | async }}
Can't bind to 'routerLink' since it isn't a known property of 'a'. ("
<a class="nav-link text-dark" [ERROR ->][routerLink]='["/authentication/logout"]' [state]='{ local: true }' title="Logout">Logout
</"): ng:///DynamicTestModule/LoginMenuComponent.html@5:39
Can't bind to 'state' since it isn't a known property of 'a'. ("class="nav-item">
<a class="nav-link text-dark" [routerLink]='["/authentication/logout"]' [ERROR ->][state]='{ local: true }' title="Logout">Logout