Created
June 8, 2017 19:40
-
-
Save maggiesavovska/fda7a7b9c090ecb63489f7b06bab2f0b to your computer and use it in GitHub Desktop.
run mocha programatically
This file contains hidden or 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
"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