UNPKG

1.82 kBJavaScriptView Raw
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3const path = require("path");
4const config_1 = require("../models/config");
5const require_project_module_1 = require("../utilities/require-project-module");
6const Task = require('../ember-cli/lib/models/task');
7const SilentError = require('silent-error');
8exports.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 // Convert browsers from a string to an array
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 // Assign additional karmaConfig options to the local ngapp config
32 karmaOptions.configFile = karmaConfig;
33 // :shipit:
34 const karmaServer = new karma.Server(karmaOptions, resolve);
35 karmaServer.start();
36 });
37 }
38});
39//# sourceMappingURL=/users/hans/sources/angular-cli/tasks/test.js.map
\No newline at end of file