Open FrancescoBorzi opened 6 years ago
Can you please try updating to v1.0.0
. I think you should not get that issue then, at least with @angular/cli
Same here.
Some of my tests fail with:
StaticInjectorError(Platform: core)[options]:
NullInjectorError: No provider for options!
Error: StaticInjectorError(DynamicTestModule)[options]:
Angular: 5.2.9 angular2-notifications: starting at 0.9.8. No difference with 1.0.0
@frauenknecht are you using
import { SimpleNotificationsModule } from 'angular2-notifications';
or
import { SimpleNotificationsModule } from 'angular2-notifications/dist';
The first one works fine for me with 1.0.0 in @angular/cli production build
@iGrubesic The First Import statement. However, compiling or running the code is not the problem. My unit tests are broken.
I bet it has something to do with providing 'options' as a string and not an InjectionToken
https://github.com/flauc/angular2-notifications/blob/master/src/index.ts
I'm unable to recreate this. What environment are you using?
Same here.
@flauc Jasmine 2.9 with new Angular 5 HttpClient and test support libraries.
The most frustrating thing is, it's working fine with karma and @angular/cli on Angular 5. Can you please create a minimal recreation on plunker?
Had the same issue, updating to 1.0.0 solved it for me.
Same issue here. Solved by using 1.0.0
Problem with 1.0.1 here. Seems that the main file can't be found. Downgraded to 0.9.7 and works.
I've just tried using version 1.0.2
(and Angular 5.2.11
) and I'm still getting this error in most of my unit tests:
NullInjectorError: No provider for options!
downgrading to version 0.9.7
solves the issue for me.
EDIT: this looks to happen only when I import NotificationsService
in my testbed among the providers. If I load the module SimpleNotificationsModule
instead than it seems to be working fine.
Using version
0.9.7
Since last time I've updated my packages, I'm getting this compilation error:
ERROR in src/app/app.module.ts(22,43): error TS2307: Cannot find module 'angular2-notifications'.
Apparently, replacing:
import { SimpleNotificationsModule } from 'angular2-notifications';
with:
import { SimpleNotificationsModule } from 'angular2-notifications/dist';
is solving the issue, but then my unit tests fail with: