Skip to content

Commit

Permalink
Add tests for mocha -h fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Zarel committed Jun 14, 2017
1 parent 0bfd2e6 commit 406a0f0
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions test/integration/options.spec.js
@@ -1,6 +1,9 @@
'use strict';

var assert = require('assert');
var childProcess = require('child_process');
var fs = require('fs');
var path = require('path');
var run = require('./helpers').runMochaJSON;
var args = [];

Expand Down Expand Up @@ -232,4 +235,28 @@ describe('options', function () {
});
});
});

describe('--help', function () {
it('works despite the presence of mocha.opts', function (done) {
var output = '';
try {
fs.mkdirSync(path.resolve(__dirname, 'test-env'));
fs.mkdirSync(path.resolve(__dirname, 'test-env/test'));
fs.writeFileSync(path.resolve(__dirname, 'test-env/test/mocha.opts'), 'foo');
var mochaLoc = path.resolve(__dirname, '../../bin/mocha');
output = '' + childProcess.execSync(mochaLoc + ' -h', {cwd: path.resolve(__dirname, 'test-env')});
} catch (e) {}
try {
fs.unlinkSync(path.resolve(__dirname, 'test-env/test/mocha.opts'));
} catch (e) {}
try {
fs.rmdirSync(path.resolve(__dirname, 'test-env/test'));
} catch (e) {}
try {
fs.rmdirSync(path.resolve(__dirname, 'test-env'));
} catch (e) {}
assert(output.indexOf('Usage:') >= 0);
done();
});
});
});

0 comments on commit 406a0f0

Please sign in to comment.