1 | 'use strict';
|
2 |
|
3 | Object.defineProperty(exports, "__esModule", {
|
4 | value: true
|
5 | });
|
6 |
|
7 | var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
8 |
|
9 | var _mocha = require('mocha');
|
10 |
|
11 | var _mocha2 = _interopRequireDefault(_mocha);
|
12 |
|
13 | var _glob = require('glob');
|
14 |
|
15 | var _glob2 = _interopRequireDefault(_glob);
|
16 |
|
17 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
18 |
|
19 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
20 |
|
21 | var Tests = function () {
|
22 | function Tests(config) {
|
23 | _classCallCheck(this, Tests);
|
24 |
|
25 | this.config = {
|
26 | verbose: config.verbose,
|
27 | glob: config.glob || './test/**/*.js',
|
28 | mocha: config.mocha || {}
|
29 | };
|
30 |
|
31 | this.mocha = new _mocha2.default(this.config.mocha);
|
32 | }
|
33 |
|
34 | _createClass(Tests, [{
|
35 | key: 'start',
|
36 | value: function start() {
|
37 | var _this = this;
|
38 |
|
39 | if (this.config.verbose) {
|
40 | console.log('Running tests...');
|
41 | }
|
42 |
|
43 | return new Promise(function (resolve, reject) {
|
44 | (0, _glob2.default)(_this.config.glob, function (err, files) {
|
45 | files.forEach(function (file) {
|
46 | return _this.mocha.addFile(file);
|
47 | });
|
48 | _this.mocha.run(function (failures) {
|
49 | return resolve(failures);
|
50 | });
|
51 | });
|
52 | });
|
53 | }
|
54 | }]);
|
55 |
|
56 | return Tests;
|
57 | }();
|
58 |
|
59 | exports.default = Tests; |
\ | No newline at end of file |