Skip to content

Instantly share code, notes, and snippets.

@maggiesavovska
Created June 8, 2017 19:40
Show Gist options
  • Save maggiesavovska/fda7a7b9c090ecb63489f7b06bab2f0b to your computer and use it in GitHub Desktop.
Save maggiesavovska/fda7a7b9c090ecb63489f7b06bab2f0b to your computer and use it in GitHub Desktop.
run mocha programatically
"use strict"
var argv = require('minimist')(process.argv.slice(2));
var utils = require('../lib/modules/utils/utility.es6');
var jsonReporter = require('../reportGenerator/reporter/reporter.js');
require('source-map-support').install();
var Mocha = require('mocha');
var path = require('path');
process.env.MOCHA_JSON_SPEC_DEST = argv.reportDir + 'results.json';
var mocha = new Mocha(
{
fullTrace:true,
reporter: jsonReporter,
stage: argv.stage,
retries:0,
useColors:true
}
);
mocha.addFile(path.join(__dirname, '../dist/lib.js'));
mocha.run(function(){
if (process.send) {
process.send({
type: 'process:msg',
data: {complete: true, id: process.pid, time: utils.getDateStamp(), loopIndex:argv.loopIndex},
});
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment