Skip to content

Commit

Permalink
upgrade to debug@2.6.8; closes #2859
Browse files Browse the repository at this point in the history
- ensure we can run the test suite with `DEBUG=mocha*` by removing it
  when spawning `mocha`
- remove some cruft in the test helpers
  • Loading branch information
boneskull committed Jun 3, 2017
1 parent acd7701 commit 6f16420
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 45 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@
"dependencies": {
"browser-stdout": "1.3.0",
"commander": "2.9.0",
"debug": "2.6.0",
"debug": "2.6.8",
"diff": "3.2.0",
"escape-string-regexp": "1.0.5",
"glob": "7.1.1",
Expand Down
49 changes: 5 additions & 44 deletions test/integration/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

var spawn = require('child_process').spawn;
var path = require('path');
var fs = require('fs');
var baseReporter = require('../../lib/reporters/base');
var create = require('lodash.create');

module.exports = {
/**
Expand Down Expand Up @@ -41,47 +41,6 @@ module.exports = {
});
},

/**
* Invokes the mocha binary on the code of the body of the function.
* Accepts an array of additional command line args to pass. The callback is
* invoked with a summary of the run, in addition to its output. The summary
* includes the number of passing, pending, and failing tests, as well as the
* exit code. Useful for testing different reporters.
*
* Example response:
* {
* pending: 0,
* passing: 0,
* failing: 1,
* code: 1,
* output: '...'
* }
*
* @param {function} fixture
* @param {array} args
* @param {function} fn
*/
runMochaFunction: function (fixture, args, fn) {
var path = resolveFixturePath(fixture.name + '.js' || 'tempfile.js');
args = args || [];

var fixtureContent = 'var fn = ' + fixture.toString() + '; fn()';
fs.writeFileSync(path, fixtureContent, 'utf8');

function cleanup () {
fs.unlink(path);
fn.apply(this, arguments);
}

invokeMocha(args.concat(['-C', path]), function (err, res) {
if (err) {
return cleanup(err);
}

cleanup(null, getSummary(res));
});
},

/**
* Invokes the mocha binary for the given fixture using the JSON reporter,
* returning the parsed output, as well as exit code.
Expand Down Expand Up @@ -157,10 +116,12 @@ module.exports = {

function invokeMocha (args, fn) {
var output, mocha, listener;

// ensure DEBUG doesn't kill tests
var env = create({}, process.env);
delete env.DEBUG;
output = '';
args = [path.join('bin', 'mocha')].concat(args);
mocha = spawn(process.execPath, args);
mocha = spawn(process.execPath, args, {env: env});

listener = function (data) {
output += data;
Expand Down

0 comments on commit 6f16420

Please sign in to comment.