How to use log4js in a test case with karma?

Currently, I need to add log4js support to my test case, for example below:

it(' QuestionController saveQuestion method Testing ', inject(function(localStorageService) { ***var log4js = require('log4js'); var logger = log4js.getLogger(); logger.debug("Some debug messages");*** expect({}).toEqual(localStorageService.get('questionInfoStorage')); })); 

I tried to include the log4js js and repire js file in the karma.conf.js file, it does not work and gives some error, for example, as the event "Module name" is not yet loaded for context ".

Is there anyone, someone else has a question? thanks in advance!

+5
source share

Source: https://habr.com/ru/post/1209194/


All Articles