Skip to content
This repository was archived by the owner on Dec 4, 2023. It is now read-only.

Commit a5d934f

Browse files
Test glob pattern equivalent of --compilers (mochajs#3005)
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.
1 parent 0958eeb commit a5d934f

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed
+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
'use strict';
2+
3+
var expect = require('expect.js');
4+
var exec = require('child_process').exec;
5+
var path = require('path');
6+
7+
describe('globbing like --compilers', function () {
8+
it('should find a file of each type', function (done) {
9+
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) {
10+
if (error && !stdout) { return done(error); }
11+
var results = JSON.parse(stdout);
12+
expect(results).to.have.property('tests');
13+
var titles = [];
14+
for (var index = 0; index < results.tests.length; index += 1) {
15+
expect(results.tests[index]).to.have.property('fullTitle');
16+
titles.push(results.tests[index].fullTitle);
17+
}
18+
expect(titles).to.contain('coffeescript should work');
19+
expect(titles).to.contain('custom compiler should work');
20+
expect(titles).to.have.length(2);
21+
done();
22+
});
23+
});
24+
});

0 commit comments

Comments
 (0)