File: compiler-globbing.spec.js

package info (click to toggle)
node-mocha 4.1.0%2Bds3-5
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 3,956 kB
  • sloc: makefile: 163; sh: 17
file content (24 lines) | stat: -rw-r--r-- 1,070 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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') + '" --timeout 10000 -R json --require coffee-script/register --require test/compiler-fixtures/foo.fixture "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();
    });
  });
});