Skip to content

Commit fda89ed

Browse files
committed
added debug argument to ng test task. This argument when passed disable instrumentation and coverage, allowing to debug the source code when running tests
1 parent a761bc5 commit fda89ed

File tree

4 files changed

+5
-4
lines changed

4 files changed

+5
-4
lines changed

addon/ng2/blueprints/ng2/files/karma.conf.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ module.exports = function (config) {
3131
}
3232
},
3333
angularCliConfig: './angular-cli.json',
34-
reporters: ['progress', 'karma-remap-istanbul'],
34+
reporters: config.debug ? ['progress'] : ['progress', 'karma-remap-istanbul'],
3535
port: 9876,
3636
colors: true,
3737
logLevel: config.LOG_INFO,

addon/ng2/commands/test.ts

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import * as TestTask from '../tasks/test';
55
module.exports = TestCommand.extend({
66
availableOptions: [
77
{ name: 'watch', type: Boolean, default: true, aliases: ['w'] },
8+
{ name: 'debug', type: Boolean, default: false, aliases: ['d'] },
89
{ name: 'browsers', type: String },
910
{ name: 'colors', type: Boolean },
1011
{ name: 'log-level', type: String },

addon/ng2/models/webpack-build-test.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
const path = require('path');
44
const webpack = require('webpack');
55

6-
const getWebpackTestConfig = function(projectRoot, appConfig) {
6+
const getWebpackTestConfig = function(projectRoot, appConfig, debug=false) {
77

88
const appRoot = path.resolve(projectRoot, appConfig.root);
99

@@ -66,7 +66,7 @@ const getWebpackTestConfig = function(projectRoot, appConfig) {
6666
{ test: /\.(jpg|png)$/, loader: 'url-loader?limit=128000' },
6767
{ test: /\.html$/, loader: 'raw-loader', exclude: [path.resolve(appRoot, appConfig.index)] }
6868
],
69-
postLoaders: [
69+
postLoaders: debug ? [] : [
7070
{
7171
test: /\.(js|ts)$/, loader: 'sourcemap-istanbul-instrumenter-loader',
7272
exclude: [

plugins/karma.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ const init = (config) => {
99
const appConfig = angularCliConfig.apps[0];
1010

1111
// add webpack config
12-
config.webpack = getWebpackTestConfig(config.basePath, appConfig);
12+
config.webpack = getWebpackTestConfig(config.basePath, appConfig, config.debug);
1313
config.webpackMiddleware = {
1414
noInfo: true, // Hide webpack output because its noisy.
1515
stats: { // Also prevent chunk and module display output, cleaner look. Only emit errors.

0 commit comments

Comments
 (0)