Skip to content

Commit

Permalink
Test glob pattern equivalent of --compilers (#3005)
Browse files Browse the repository at this point in the history
This ensures that users can glob for multiple file extensions. That means two things:

- We could theoretically deprecate `--compilers` in favor of the other options (and globbing) for which it's shorthand.
- If we upgrade glob and the syntax to do this changes, we'll know due to the test failing.
  • Loading branch information
ScottFreeCode authored Sep 14, 2017
1 parent e838a77 commit 82c9cb4
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions test/integration/compiler-globbing.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
'use strict';

var expect = require('expect.js');
var exec = require('child_process').exec;
var path = require('path');

describe('globbing like --compilers', function () {
it('should find a file of each type', function (done) {
exec('"' + process.execPath + '" "' + path.join('bin', 'mocha') + '" -R json --require coffee-script/register --require test/compiler-fixtures/foo "test/compiler/*.@(coffee|foo)"', { cwd: path.join(__dirname, '..', '..') }, function (error, stdout) {
if (error && !stdout) { return done(error); }
var results = JSON.parse(stdout);
expect(results).to.have.property('tests');
var titles = [];
for (var index = 0; index < results.tests.length; index += 1) {
expect(results.tests[index]).to.have.property('fullTitle');
titles.push(results.tests[index].fullTitle);
}
expect(titles).to.contain('coffeescript should work');
expect(titles).to.contain('custom compiler should work');
expect(titles).to.have.length(2);
done();
});
});
});

0 comments on commit 82c9cb4

Please sign in to comment.