Last active
April 28, 2022 14:11
-
-
Save DanteDeRuwe/97fdaf252dc7540a7af8d21f436f512d to your computer and use it in GitHub Desktop.
Enable logging in karma.conf.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
browserConsoleLogOptions: { | |
level: 'log', | |
format: '%b %T: %m', | |
terminal: true, | |
}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jasmine.getEnv().addReporter({ | |
specStarted: (result) => { | |
(jasmine as any).currentTest = result; | |
}, | |
specDone: (result) => { | |
(jasmine as any).currentTest = result; | |
}, | |
}); | |
afterEach(() => { | |
const pass = | |
(jasmine as any).currentTest.failedExpectations.length === 0; | |
console[pass ? 'log' : 'error'](`[${pass ? 'pass' : 'FAIL'}]`, { | |
name: (jasmine as any).currentTest, | |
//... extra params to log | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment