Unit testing in angular 6 with ngx-logger dependency

Viewed 1941

Is there a way to properly test classes that have ngx-logger as dependency in angular (Assuming we may be using some known framework for testing, like jasmine)? So far there isn't a resource that can help me to provide a use case where the ngx-logger was mocked or provided in unit tests for classes that have this dependency.

2 Answers

As mentioned in the comments, I found the solution here for anyone who may be facing this problem.

As explained in NGXLogger docs, import LoggerTestingModule in your tests:

TestBed.configureTestingModule({
  imports: [
    LoggerTestingModule
  ],
  ...
});
Related