When running Karma and Jasmine tests using the
npm run test -- --no-watch --no-progress
command with Karma/Jasmine, an error is thrown:
Chrome 92.0.4515.159 (Mac OS 10.15.7) LoginComponent should create FAILED
TypeError: this.loggerService.onDebug is not a function
at LoginComponent.ngAfterViewInit (src/app/pages/login/login.component.ts:22:24)
...
Greetings,
I am currently working on a Logger Service in Angular version 12.0.x that forwards log messages to both ngx-logger (e.g., an external server) and a store (ngxs).
The karma.conf.js
file is located at the root of the application.
The Logger Service (logging-service.ts
) is pretty straightforward:
import { Injectable } from '@angular/core';
...
@Injectable({
providedIn: 'root',
})
export class LoggerService {
...
The Logger Service's methods are utilized in two different components:
- Login Component
- Log Manager Component
Any suggestions on how to approach this issue? :)