Skip to content

Instantly share code, notes, and snippets.

@just-boris
Created April 18, 2017 14:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save just-boris/41468fac9ac81cbb5debb7eb55b13744 to your computer and use it in GitHub Desktop.
Save just-boris/41468fac9ac81cbb5debb7eb55b13744 to your computer and use it in GitHub Desktop.
Allure grunt plugin
module.exports = grunt => {
const allure = require('allure-commandline');
grunt.registerMultiTask('allure', 'Passes commands to allure-commandline', function() {
const done = this.async();
const options = this.options();
const args = [];
if(this.target === 'generate') {
args.push('generate');
if(options.clean) {
args.push('--clean');
}
if(options.reportDir) {
args.push('--report-dir');
args.push(options.reportDir);
}
args.push(this.data);
} else if(this.target === 'open') {
args.push('open');
args.push(options.reportDir);
} else {
throw new Error('Unknown target:', this.target);
}
const allureProcess = allure(args);
allureProcess.on('exit', done)
});
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment