Skip to content

Commit 45143c8

Browse files
committed
Improve test for mocha -f fix
1 parent 406a0f0 commit 45143c8

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

test/integration/options.spec.js

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -237,15 +237,17 @@ describe('options', function () {
237237
});
238238

239239
describe('--help', function () {
240-
it('works despite the presence of mocha.opts', function (done) {
241-
var output = '';
242-
try {
243-
fs.mkdirSync(path.resolve(__dirname, 'test-env'));
244-
fs.mkdirSync(path.resolve(__dirname, 'test-env/test'));
245-
fs.writeFileSync(path.resolve(__dirname, 'test-env/test/mocha.opts'), 'foo');
246-
var mochaLoc = path.resolve(__dirname, '../../bin/mocha');
247-
output = '' + childProcess.execSync(mochaLoc + ' -h', {cwd: path.resolve(__dirname, 'test-env')});
248-
} catch (e) {}
240+
before(function () {
241+
fs.mkdirSync(path.resolve(__dirname, 'test-env'));
242+
fs.mkdirSync(path.resolve(__dirname, 'test-env/test'));
243+
fs.writeFileSync(path.resolve(__dirname, 'test-env/test/mocha.opts'), 'foo');
244+
});
245+
it('works despite the presence of mocha.opts', function () {
246+
var mochaLoc = path.resolve(__dirname, '../../bin/mocha');
247+
var output = '' + childProcess.execSync(mochaLoc + ' -h', {cwd: path.resolve(__dirname, 'test-env')});
248+
expect(output).to.contain('Usage:');
249+
});
250+
after(function () {
249251
try {
250252
fs.unlinkSync(path.resolve(__dirname, 'test-env/test/mocha.opts'));
251253
} catch (e) {}
@@ -255,8 +257,6 @@ describe('options', function () {
255257
try {
256258
fs.rmdirSync(path.resolve(__dirname, 'test-env'));
257259
} catch (e) {}
258-
assert(output.indexOf('Usage:') >= 0);
259-
done();
260260
});
261261
});
262262
});

0 commit comments

Comments
 (0)