Skip to content
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions addon/ng2/blueprints/ng2/files/config/karma.conf.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Karma configuration file, see link for more information
// Karma configuration file, see link for more information
// https://karma-runner.github.io/0.13/config/configuration-file.html

module.exports = function (config) {
Expand All @@ -9,6 +9,7 @@ module.exports = function (config) {
require('karma-jasmine'),
require('karma-chrome-launcher'),
require('karma-coverage'),
require('karma-remap-istanbul'),
require('angular-cli/plugins/karma')
],
customLaunchers: {
Expand All @@ -24,8 +25,19 @@ module.exports = function (config) {
preprocessors: {
'./src/test.ts': ['angular-cli']
},
coverageReporter: {
dir: 'coverage',
reporters: [
{ type : 'json', subdir: '.', file: 'coverage-final.json'}
]
},

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason to keep using karma-coverage? karma-remap-istanbul produces the coverage report and no longer needs the intermediate file and instrumenting is done by sourcemap-istanbul-instrumenter-loader.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you are correct. I misunderstood the docs for the karma plugin

remapIstanbulReporter: {
reports: {
html: 'coverage/report'
}
},
angularCliConfig: './angular-cli.json',
reporters: ['coverage', 'progress'],
reporters: ['coverage', 'progress', 'karma-remap-istanbul'],
port: 9876,
colors: true,
logLevel: config.LOG_INFO,
Expand Down
1 change: 1 addition & 0 deletions addon/ng2/blueprints/ng2/files/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
"karma-chrome-launcher": "0.2.3",
"karma-coverage": "^1.0.0",
"karma-jasmine": "0.3.8",
"karma-remap-istanbul": "^0.2.1",
"protractor": "3.3.0",
"ts-node": "1.2.1",
"tslint": "3.13.0",
Expand Down
6 changes: 3 additions & 3 deletions addon/ng2/models/webpack-build-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,7 @@ const getWebpackTestConfig = function(projectRoot, sourceDir) {
tsconfig: path.resolve(projectRoot, `./${sourceDir}/tsconfig.json`),
module: 'commonjs',
target: 'es5',
useForkChecker: true,
removeComments: true
useForkChecker: true
}
},
{
Expand All @@ -70,7 +69,8 @@ const getWebpackTestConfig = function(projectRoot, sourceDir) {
exclude: [
/\.(e2e|spec)\.ts$/,
/node_modules/
]
],
query: { 'force-sourcemap': true }
}
]
},
Expand Down
8 changes: 8 additions & 0 deletions tests/e2e/e2e_workflow.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,14 @@ describe('Basic end-to-end Workflow', function () {
});
});

it('Make sure the correct coverage folder is created', function () {
const coverageJson = path.join(process.cwd(), 'coverage', 'coverage-final.json');
const coverageReport = path.join(process.cwd(), 'coverage', 'report', 'src', 'app');

expect(existsSync(coverageJson)).to.be.equal(true);
expect(existsSync(coverageReport)).to.be.equal(true);
});

it('moves all files that live inside `public` into `dist`', function () {
this.timeout(420000);

Expand Down