A reporter for Jasmine which produces a report compatible with Atlassian Bamboo Mocha Test Parser. It supports 'test sharding' or multiple instances of Jasmine running via Protractor. This support is handled by locking the results file and then merging with any previous results.
npm install jasmine-bamboo-reporter
var JSONReporter = require('jasmine-bamboo-reporter');
jasmine.getEnv().addReporter(new JSONReporter({
file: 'jasmine-results.json', // by default it writes to jasmine.json
beautify: true,
indentationLevel: 4 // used if beautify === true
}));
//ensure there are no lock files and no previous results to merge against.
if (fs.existsSync("jasmine-results.json.lock")) fs.unlinkSync("jasmine-results.json.lock");
if (fs.existsSync("jasmine-results.json")) fs.unlinkSync("jasmine-results.json");
// in Protractor conf
var JSONReporter = require('jasmine-bamboo-reporter');
var fs = require('fs');
exports.config = {
framework: 'jasmine2',
...
beforeLaunch: function () {
//clean up any residual/leftover from a previous run. Ensure we have clean
//files for both locking and merging.
if (fs.existsSync('jasmine-results.json.lock')) {
fs.unlinkSync('jasmine-results.json.lock');
}
if (fs.existsSync('jasmine-results.json')) {
fs.unlink('jasmine-results.json');
}
},
onPrepare: function() {
jasmine.getEnv().addReporter(new JSONReporter({
file: 'jasmine-results.json', // by default it writes to jasmine.json
beautify: true,
indentationLevel: 4 // used if beautify === true
}));
}