UNPKG

1.85 kBJavaScriptView Raw
1(function (factory) {
2 if (typeof module === "object" && typeof module.exports === "object") {
3 var v = factory(require, exports);
4 if (v !== undefined) module.exports = v;
5 }
6 else if (typeof define === "function" && define.amd) {
7 define(["require", "exports", "tslib", "@theintern/common", "../lib/executors/Node", "../lib/node/util"], factory);
8 }
9})(function (require, exports) {
10 "use strict";
11 var tslib_1 = require("tslib");
12 var common_1 = require("@theintern/common");
13 var Node_1 = require("../lib/executors/Node");
14 var util_1 = require("../lib/node/util");
15 function getConfigAndOptions(options) {
16 if (options.config) {
17 return util_1.getConfig(options.config, []).then(function (_a) {
18 var config = _a.config;
19 var opts = tslib_1.__assign({}, options);
20 delete opts.config;
21 return { config: config, options: opts };
22 });
23 }
24 return Promise.resolve({ config: {}, options: options });
25 }
26 return function (grunt) {
27 grunt.registerMultiTask('intern', function () {
28 var done = this.async();
29 var options = this.options({});
30 process.env.FORCE_COLOR = 'true';
31 getConfigAndOptions(options)
32 .then(function (_a) {
33 var config = _a.config, options = _a.options;
34 var intern = (common_1.global.intern = new Node_1.default());
35 intern.configure(config);
36 intern.configure(options);
37 return intern.run();
38 })
39 .then(finish, finish);
40 function finish(error) {
41 common_1.global.intern = null;
42 done(error);
43 }
44 });
45 };
46});
47//# sourceMappingURL=intern.js.map
\No newline at end of file