Skip to content

Instantly share code, notes, and snippets.

@agirorn
Created May 28, 2020 14:58
Show Gist options
  • Save agirorn/99b8850ccfed7968a3f999894ce9d6d9 to your computer and use it in GitHub Desktop.
Save agirorn/99b8850ccfed7968a3f999894ce9d6d9 to your computer and use it in GitHub Desktop.
Custom jasmine reporter (prints name, file, line number and status of each spec being run).
const jasmineSlowReporter = require('jasmine-slow-reporter');
jasmine.getEnv().addReporter(jasmineSlowReporter);
jasmineSlowReporter.threshold = process.env.TEST_SLOW_THRESHOLD || 50;
class CustomReporter {
specStarted(spec) {
const {
fullName,
_jasmineSlowReporter: {
filename,
line,
},
} = spec;
console.log('=>', fullName);
console.log(` ${filename}#${line}`);
}
specDone(spec) {
const { status } = spec;
console.log(` status: ${status}`);
}
}
jasmine.getEnv().addReporter(new CustomReporter());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment