1 | "use strict";
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 | const path = require("path");
|
4 | const config_1 = require("../models/config");
|
5 | const require_project_module_1 = require("../utilities/require-project-module");
|
6 | const Task = require('../ember-cli/lib/models/task');
|
7 | const SilentError = require('silent-error');
|
8 | exports.default = Task.extend({
|
9 | run: function (options) {
|
10 | const projectConfig = config_1.CliConfig.fromProject().config;
|
11 | const projectRoot = this.project.root;
|
12 | if (projectConfig.project && projectConfig.project.ejected) {
|
13 | throw new SilentError('An ejected project cannot use the build command anymore.');
|
14 | }
|
15 | return new Promise((resolve) => {
|
16 | const karma = require_project_module_1.requireProjectModule(projectRoot, 'karma');
|
17 | const karmaConfig = path.join(projectRoot, options.config ||
|
18 | this.project.ngConfig.config.test.karma.config);
|
19 | let karmaOptions = Object.assign({}, options);
|
20 |
|
21 | if (options.browsers) {
|
22 | karmaOptions.browsers = options.browsers.split(',');
|
23 | }
|
24 | karmaOptions.angularCli = {
|
25 | codeCoverage: options.codeCoverage,
|
26 | sourcemap: options.sourcemap,
|
27 | progress: options.progress,
|
28 | poll: options.poll,
|
29 | app: options.app
|
30 | };
|
31 |
|
32 | karmaOptions.configFile = karmaConfig;
|
33 |
|
34 | const karmaServer = new karma.Server(karmaOptions, resolve);
|
35 | karmaServer.start();
|
36 | });
|
37 | }
|
38 | });
|
39 |
|
\ | No newline at end of file |