UNPKG

1.92 kBJavaScriptView Raw
1// Generated by CoffeeScript 1.6.3
2/* NO FLUSH*/
3
4/* not in use*/
5
6var EventEmitter, Mocha, emitter,
7 __slice = [].slice;
8
9EventEmitter = require('events').EventEmitter;
10
11module.exports = emitter = new EventEmitter;
12
13Mocha = require('mocha');
14
15module.exports.create = function(opts) {
16 var api, mocha;
17 mocha = new Mocha({
18 reporter: function(runner) {
19 /*
20
21 from: mocha/lib/runner.js
22
23 Events:
24
25 - `start` execution started
26 - `end` execution complete
27 - `suite` (suite) test suite execution started
28 - `suite end` (suite) all tests (and sub-suites) have finished
29 - `test` (test) test execution started
30 - `test end` (test) test completed
31 - `hook` (hook) hook execution started
32 - `hook end` (hook) hook complete
33 - `pass` (test) test passed
34 - `fail` (test, err) test failed
35 - `pending` (test) test pending
36 */
37
38 var event, _i, _len, _ref, _results;
39 _ref = ['start', 'end', 'suite', 'suite end', 'test', 'test end', 'hook', 'hook end', 'pass', 'fail', 'pending'];
40 _results = [];
41 for (_i = 0, _len = _ref.length; _i < _len; _i++) {
42 event = _ref[_i];
43 _results.push((function(event) {
44 return runner.on(event, function() {
45 var data;
46 data = 1 <= arguments.length ? __slice.call(arguments, 0) : [];
47 return emitter.emit('spec_event', {
48 source: 'mocha',
49 event: event,
50 data: data
51 });
52 });
53 })(event));
54 }
55 return _results;
56 }
57 });
58 return api = {
59 run: function(files, callback) {
60 var file, _i, _len;
61 for (_i = 0, _len = files.length; _i < _len; _i++) {
62 file = files[_i];
63 mocha.addFile(file);
64 }
65 return mocha.run(callback);
66 }
67 };
68};