Skip to content

Commit 4e8bcc5

Browse files
filipesilvajohannes.werner
authored and
johannes.werner
committed
feat(test): add karma plugin (angular#1437)
1 parent 6dbe813 commit 4e8bcc5

File tree

3 files changed

+7
-104
lines changed

3 files changed

+7
-104
lines changed

addon/ng2/blueprints/ng2/files/package.json

+1
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
"jasmine-spec-reporter": "2.5.0",
4444
"karma": "0.13.22",
4545
"karma-chrome-launcher": "0.2.3",
46+
"karma-coverage": "^1.0.0",
4647
"karma-jasmine": "0.3.8",
4748
"karma-remap-istanbul": "^0.2.1",
4849
"protractor": "3.3.0",

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

+6-13
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
// this config must be JS so that the karma plugin can load it
22

33
const path = require('path');
4-
const webpack = require('webpack');
54

65
const getWebpackTestConfig = function(projectRoot, sourceDir) {
76
return {
@@ -43,10 +42,12 @@ const getWebpackTestConfig = function(projectRoot, sourceDir) {
4342
{
4443
loader: 'awesome-typescript-loader',
4544
query: {
45+
useWebpackText: true,
4646
tsconfig: path.resolve(projectRoot, `./${sourceDir}/tsconfig.json`),
4747
module: 'commonjs',
4848
target: 'es5',
49-
useForkChecker: true
49+
useForkChecker: true,
50+
removeComments: true
5051
}
5152
},
5253
{
@@ -59,7 +60,7 @@ const getWebpackTestConfig = function(projectRoot, sourceDir) {
5960
{ test: /\.css$/, loaders: ['raw-loader', 'postcss-loader'] },
6061
{ test: /\.styl$/, loaders: ['raw-loader', 'postcss-loader', 'stylus-loader'] },
6162
{ test: /\.less$/, loaders: ['raw-loader', 'postcss-loader', 'less-loader'] },
62-
{ test: /\.scss$|\.sass$/, loaders: ['raw-loader', 'postcss-loader', 'sass-loader'] },
63+
{ test: /\.scss$/, loaders: ['raw-loader', 'postcss-loader', 'sass-loader'] },
6364
{ test: /\.(jpg|png)$/, loader: 'url-loader?limit=128000' },
6465
{ test: /\.html$/, loader: 'raw-loader', exclude: [path.resolve(projectRoot, `./${sourceDir}/index.html`)] }
6566
],
@@ -69,24 +70,16 @@ const getWebpackTestConfig = function(projectRoot, sourceDir) {
6970
exclude: [
7071
/\.(e2e|spec)\.ts$/,
7172
/node_modules/
72-
],
73-
query: { 'force-sourcemap': true }
73+
]
7474
}
7575
]
7676
},
77-
plugins: [
78-
new webpack.SourceMapDevToolPlugin({
79-
filename: null, // if no value is provided the sourcemap is inlined
80-
test: /\.(ts|js)($|\?)/i // process .js and .ts files only
81-
})
82-
],
8377
tslint: {
8478
emitErrors: false,
8579
failOnHint: false,
8680
resourcePath: `./${sourceDir}`
8781
},
8882
node: {
89-
fs: 'empty',
9083
global: 'window',
9184
process: false,
9285
crypto: 'empty',
@@ -97,4 +90,4 @@ const getWebpackTestConfig = function(projectRoot, sourceDir) {
9790
};
9891
}
9992

100-
module.exports.getWebpackTestConfig = getWebpackTestConfig;
93+
module.exports.getWebpackTestConfig = getWebpackTestConfig;

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

-91
This file was deleted.

0 commit comments

Comments
 (0)