Skip to content

Commit 36c0ee5

Browse files
Danny Bluefilipesilva
Danny Blue
authored andcommitted
feat (CodeCoverage): use karma-remap-istanbul (#1468)
1 parent 5ea4b03 commit 36c0ee5

File tree

4 files changed

+18
-7
lines changed

4 files changed

+18
-7
lines changed

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

+8-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Karma configuration file, see link for more information
1+
// Karma configuration file, see link for more information
22
// https://karma-runner.github.io/0.13/config/configuration-file.html
33

44
module.exports = function (config) {
@@ -8,7 +8,7 @@ module.exports = function (config) {
88
plugins: [
99
require('karma-jasmine'),
1010
require('karma-chrome-launcher'),
11-
require('karma-coverage'),
11+
require('karma-remap-istanbul'),
1212
require('angular-cli/plugins/karma')
1313
],
1414
customLaunchers: {
@@ -24,8 +24,13 @@ module.exports = function (config) {
2424
preprocessors: {
2525
'./src/test.ts': ['angular-cli']
2626
},
27+
remapIstanbulReporter: {
28+
reports: {
29+
html: 'coverage'
30+
}
31+
},
2732
angularCliConfig: './angular-cli.json',
28-
reporters: ['coverage', 'progress'],
33+
reporters: ['progress', 'karma-remap-istanbul'],
2934
port: 9876,
3035
colors: true,
3136
logLevel: config.LOG_INFO,

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@
4242
"jasmine-spec-reporter": "2.5.0",
4343
"karma": "0.13.22",
4444
"karma-chrome-launcher": "0.2.3",
45-
"karma-coverage": "^1.0.0",
4645
"karma-jasmine": "0.3.8",
46+
"karma-remap-istanbul": "^0.2.1",
4747
"protractor": "3.3.0",
4848
"ts-node": "1.2.1",
4949
"tslint": "3.13.0",

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

+3-3
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,7 @@ const getWebpackTestConfig = function(projectRoot, sourceDir) {
4646
tsconfig: path.resolve(projectRoot, `./${sourceDir}/tsconfig.json`),
4747
module: 'commonjs',
4848
target: 'es5',
49-
useForkChecker: true,
50-
removeComments: true
49+
useForkChecker: true
5150
}
5251
},
5352
{
@@ -70,7 +69,8 @@ const getWebpackTestConfig = function(projectRoot, sourceDir) {
7069
exclude: [
7170
/\.(e2e|spec)\.ts$/,
7271
/node_modules/
73-
]
72+
],
73+
query: { 'force-sourcemap': true }
7474
}
7575
]
7676
},

tests/e2e/e2e_workflow.spec.js

+6
Original file line numberDiff line numberDiff line change
@@ -283,6 +283,12 @@ describe('Basic end-to-end Workflow', function () {
283283
});
284284
});
285285

286+
it('Make sure the correct coverage folder is created', function () {
287+
const coverageReport = path.join(process.cwd(), 'coverage', 'src', 'app');
288+
289+
expect(existsSync(coverageReport)).to.be.equal(true);
290+
});
291+
286292
it('moves all files that live inside `public` into `dist`', function () {
287293
this.timeout(420000);
288294

0 commit comments

Comments
 (0)