Welcome to mirror list, hosted at ThFree Co, Russian Federation.

simple-ui.js « 1794 « regression « fixtures « integration « test « mocha-3.1.0 « lib « tests - github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 1fdf33d6657b1a18d5baf32adae563ac91f465b9 (plain)
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
var path  = '../../../../../lib/',
    Mocha = require(path + 'mocha');
    Suite = require(path + 'suite'),
    Test  = require(path + 'test');

/**
 * A simple UI that only exposes a single function: test
 */
module.exports = Mocha.interfaces['simple-ui'] = function(suite) {
  suite.on('pre-require', function(context, file, mocha) {
    var common = require(path + 'interfaces/common')([suite], context);

    context.run = mocha.options.delay && common.runWithSuite(suite);

    /**
     * Describes a specification or test-case with the given `title`
     * and callback `fn` acting as a thunk.
     */
    context.test = function(title, fn) {
      var test = new Test(title, fn);
      test.file = file;
      suite.addTest(test);

      return test;
    };
  });
};