diff --git a/packages/angular-cli/blueprints/ng2/files/karma.conf.js b/packages/angular-cli/blueprints/ng2/files/karma.conf.js index 5c349bd00abd..bdbaf86a8a90 100644 --- a/packages/angular-cli/blueprints/ng2/files/karma.conf.js +++ b/packages/angular-cli/blueprints/ng2/files/karma.conf.js @@ -27,7 +27,7 @@ module.exports = function (config) { config: './angular-cli.json', environment: 'dev' }, - reporters: ['progress', 'karma-remap-istanbul'], + reporters: config.debug ? ['progress'] : ['progress', 'karma-remap-istanbul'], port: 9876, colors: true, logLevel: config.LOG_INFO, diff --git a/packages/angular-cli/commands/test.ts b/packages/angular-cli/commands/test.ts index 74049b943c1c..264d9d0e1080 100644 --- a/packages/angular-cli/commands/test.ts +++ b/packages/angular-cli/commands/test.ts @@ -5,6 +5,7 @@ import {CliConfig} from '../models/config'; const NgCliTestCommand = TestCommand.extend({ availableOptions: [ { name: 'watch', type: Boolean, default: true, aliases: ['w'] }, + { name: 'debug', type: Boolean, default: false, aliases: ['d'] }, { name: 'browsers', type: String }, { name: 'colors', type: Boolean }, { name: 'log-level', type: String }, diff --git a/packages/angular-cli/models/webpack-build-test.js b/packages/angular-cli/models/webpack-build-test.js index dfb6deba34ff..8946e75a10f2 100644 --- a/packages/angular-cli/models/webpack-build-test.js +++ b/packages/angular-cli/models/webpack-build-test.js @@ -3,9 +3,10 @@ const path = require('path'); const webpack = require('webpack'); -const getWebpackTestConfig = function (projectRoot, environment, appConfig) { +const getWebpackTestConfig = function (projectRoot, environment, appConfig, debug) { const appRoot = path.resolve(projectRoot, appConfig.root); + var debug = typeof debug !== 'undefined' ? debug : false; return { devtool: 'inline-source-map', @@ -66,7 +67,7 @@ const getWebpackTestConfig = function (projectRoot, environment, appConfig) { { test: /\.(jpg|png)$/, loader: 'url-loader?limit=128000' }, { test: /\.html$/, loader: 'raw-loader', exclude: [path.resolve(appRoot, appConfig.index)] } ], - postLoaders: [ + postLoaders: debug ? [] : [ { test: /\.(js|ts)$/, loader: 'sourcemap-istanbul-instrumenter-loader', exclude: [ diff --git a/packages/angular-cli/plugins/karma.js b/packages/angular-cli/plugins/karma.js index 1c17e28e3771..23c6cb594bcd 100644 --- a/packages/angular-cli/plugins/karma.js +++ b/packages/angular-cli/plugins/karma.js @@ -12,7 +12,7 @@ const init = (config) => { const environment = config.angularCli.environment || 'dev'; // add webpack config - const webpackConfig = getWebpackTestConfig(config.basePath, environment, appConfig); + config.webpack = getWebpackTestConfig(config.basePath, environment, appConfig, config.debug); const webpackMiddlewareConfig = { noInfo: true, // Hide webpack output because its noisy. stats: { // Also prevent chunk and module display output, cleaner look. Only emit errors. @@ -25,7 +25,6 @@ const init = (config) => { chunkModules: false } }; - config.webpack = Object.assign(webpackConfig, config.webpack); config.webpackMiddleware = Object.assign(webpackMiddlewareConfig, config.webpackMiddleware); // replace the angular-cli preprocessor with webpack+sourcemap @@ -45,4 +44,4 @@ preprocessor.$inject = [] module.exports = Object.assign({ 'framework:angular-cli': ['factory', init], 'preprocessor:angular-cli': ['factory', preprocessor] -}, require('karma-webpack'), require('karma-sourcemap-loader')); \ No newline at end of file +}, require('karma-webpack'), require('karma-sourcemap-loader'));