Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] multiple error while trying to run unit test #24

Open
kuldiprindani opened this issue Jan 2, 2022 · 2 comments
Open

[Bug] multiple error while trying to run unit test #24

kuldiprindani opened this issue Jan 2, 2022 · 2 comments

Comments

@kuldiprindani
Copy link

Version

1.2.0

Reproduction link

https://jsfiddle.net/

Operating System

win10

Device

PC

Browser & Version

chrome

Steps to reproduce

Just run the unit test.

What is expected?

it should run & complete end successfully

What is actually happening?

typo error resulting in compilation error with name of vector component.

src\app\components\vector-map\vector-map.component.spec.ts

VectorMapComponent instead of VectorMapComponent1

Errors while running unit test.

Chrome 96.0.4664 (Windows 10.0.0): Executed 4 of 17 (3 FAILED) (0 secs / 0.142 secs)
Chrome 96.0.4664 (Windows 10.0.0) AdminLayoutComponent should create FAILED
NullInjectorError: R3InjectorError(DynamicTestModule)[Router -> Router]:
NullInjectorError: No provider for Router!
error properties: Object({ ngTempTokenPath: null, ngTokenPath: [ 'Router', 'Router' ] })
at
at NullInjector.get (http://localhost:9876/_karma_webpack_/node_modules/@angular/core/__ivy_ngcc__/fesm2015/core.js:10810:1)
at R3Injector.get (http://localhost:9876/_karma_webpack_/node_modules/@angular/core/__ivy_ngcc__/fesm2015/core.js:10977:1)
at R3Injector.get (http://localhost:9876/_karma_webpack_/node_modules/@angular/core/__ivy_ngcc__/fesm2015/core.js:10977:1)
at NgModuleRef$1.get (http://localhost:9876/_karma_webpack_/node_modules/@angular/core/__ivy_ngcc__/fesm2015/core.js:25033:1)
at Object.get (http://localhost:9876/_karma_webpack_/node_modules/@angular/core/__ivy_ngcc__/fesm2015/core.js:24747:1)
at lookupTokenUsingModuleInjector (http://localhost:9876/_karma_webpack_/node_modules/@angular/core/__ivy_ngcc__/fesm2015/core.js:3296:1)
at getOrCreateInjectable (http://localhost:9876/_karma_webpack_/node_modules/@angular/core/__ivy_ngcc__/fesm2015/core.js:3408:1)
at ɵɵdirectiveInject (http://localhost:9876/_karma_webpack_/node_modules/@angular/core/__ivy_ngcc__/fesm2015/core.js:14415:1)
at NodeInjectorFactory.AdminLayoutComponent_Factory [as factory] (ng:///AdminLayoutComponent/ɵfac.js:5:48)
at getNodeInjectable (http://localhost:9876/_karma_webpack_/node_modules/@angular/core/__ivy_ngcc__/fesm2015/core.js:3503:1)
Error: Expected undefined to be truthy.
at
at UserContext. (http://localhost:9876/_karma_webpack_/src/app/layouts/admin-layout/admin-layout.component.spec.ts:22:23)
at ZoneDelegate.invoke (http://localhost:9876/_karma_webpack_/node_modules/zone.js/dist/zone-evergreen.js:365:1)
at ProxyZoneSpec.onInvoke (http://localhost:9876/_karma_webpack_/node_modules/zone.js/dist/zone-testing.js:305:1)
Chrome 96.0.4664 (Windows 10.0.0): Executed 6 of 17 (4 FAILED) (0 secs / 0.171 secs)
Chrome 96.0.4664 (Windows 10.0.0) AdminLayoutComponent should create FAILED
NullInjectorError: R3InjectorError(DynamicTestModule)[Router -> Router]:
NullInjectorError: No provider for Router!
error properties: Object({ ngTempTokenPath: null, ngTokenPath: [ 'Router', 'Router' ] })
at
at NullInjector.get (http://localhost:9876/_karma_webpack_/node_modules/@angular/core/__ivy_ngcc__/fesm2015/core.js:10810:1)
at R3Injector.get (http://localhost:9876/_karma_webpack_/node_modules/@angular/core/__ivy_ngcc__/fesm2015/core.js:10977:1)
at R3Injector.get (http://localhost:9876/_karma_webpack_/node_modules/@angular/core/__ivy_ngcc__/fesm2015/core.js:10977:1)
at NgModuleRef$1.get (http://localhost:9876/_karma_webpack_/node_modules/@angular/core/__ivy_ngcc__/fesm2015/core.js:25033:1)
at Object.get (http://localhost:9876/_karma_webpack_/node_modules/@angular/core/__ivy_ngcc__/fesm2015/core.js:24747:1)
at lookupTokenUsingModuleInjector (http://localhost:9876/_karma_webpack_/node_modules/@angular/core/__ivy_ngcc__/fesm2015/core.js:3296:1)
at getOrCreateInjectable (http://localhost:9876/_karma_webpack_/node_modules/@angular/core/__ivy_ngcc__/fesm2015/core.js:3408:1)
at ɵɵdirectiveInject (http://localhost:9876/_karma_webpack_/node_modules/@angular/core/__ivy_ngcc__/fesm2015/core.js:14415:1)
at NodeInjectorFactory.AdminLayoutComponent_Factory [as factory] (ng:///AdminLayoutComponent/ɵfac.js:5:48)
at getNodeInjectable (http://localhost:9876/_karma_webpack_/node_modules/@angular/core/__ivy_ngcc__/fesm2015/core.js:3503:1)
Error: Expected undefined to be truthy.
at
at UserContext. (http://localhost:9876/_karma_webpack_/src/app/layouts/admin-layout/admin-layout.component.spec.ts:22:23)
at ZoneDelegate.invoke (http://localhost:9876/_karma_webpack_/node_modules/zone.js/dist/zone-evergreen.js:365:1)
Chrome 96.0.4664 (Windows 10.0.0) NavbarComponent should create FAILED
NullInjectorError: R3InjectorError(DynamicTestModule)[Router -> Router]:
NullInjectorError: No provider for Router!
error properties: Object({ ngTempTokenPath: null, ngTokenPath: [ 'Router', 'Router' ] })


Solution

Additional comments

@rarestoma
Copy link
Contributor

Hi @kuldiprindani,

Thank you for working with our products.

Can you please tell me what command did you use so I can test and find a solution?

Thank you,
Rares

@kuldiprindani
Copy link
Author

I was simply running "ng test" command.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants