File: suite.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 (52 lines) | stat: -rw-r--r-- 1,521 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
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
'use strict';

var assert = require('assert');
var run = require('./helpers').runMocha;
var args = [];

describe('suite w/no callback', function () {
  this.timeout(5000);
  it('should throw a helpful error message when a callback for suite is not supplied', function (done) {
    run('suite/suite-no-callback.fixture.js', args, function (err, res) {
      if (err) {
        done(err);
        return;
      }
      var result = res.output.match(/no callback was supplied/) || [];
      assert.equal(result.length, 1);
      done();
    });
  });
});

describe('skipped suite w/no callback', function () {
  this.timeout(5000);
  it('should not throw an error when a callback for skipped suite is not supplied', function (done) {
    run('suite/suite-skipped-no-callback.fixture.js', args, function (err, res) {
      if (err) {
        done(err);
        return;
      }
      var pattern = new RegExp('Error', 'g');
      var result = res.output.match(pattern) || [];
      assert.equal(result.length, 0);
      done();
    });
  });
});

describe('skipped suite w/ callback', function () {
  this.timeout(5000);
  it('should not throw an error when a callback for skipped suite is supplied', function (done) {
    run('suite/suite-skipped-callback.fixture.js', args, function (err, res) {
      if (err) {
        done(err);
        return;
      }
      var pattern = new RegExp('Error', 'g');
      var result = res.output.match(pattern) || [];
      assert.equal(result.length, 0);
      done();
    });
  });
});