imporve test configuration

This commit is contained in:
Eugenio Romano
2016-05-28 00:52:27 +01:00
parent 821aa7d74d
commit 919eb14de7
21 changed files with 105 additions and 31 deletions

View File

@@ -31,6 +31,12 @@ npm run build
npm test
```
## Running unit tests in browser
```sh
npm test-browser
```
This task rebuilds all the code, runs tslint, license checks and other quality check tools
before performing unit testing.

View File

@@ -53,11 +53,12 @@ module.exports = function (config) {
'karma-jasmine',
'karma-coverage',
'karma-chrome-launcher',
'karma-mocha-reporter'
'karma-mocha-reporter',
'karma-jasmine-html-reporter'
],
// Coverage reporter generates the coverage
reporters: ['mocha', 'coverage'],
reporters: ['mocha', 'coverage', 'kjhtml'],
// Source files that you wanna generate coverage for.
// Do not include tests or libraries (these files will be instrumented by Istanbul)
@@ -67,7 +68,9 @@ module.exports = function (config) {
coverageReporter: {
dir: 'coverage/',
subdir: 'report',
reporters: [
{type: 'text'},
{type: 'text-summary'},
{type: 'json', subdir: '.', file: 'coverage-final.json'},
{type: 'html'}

View File

@@ -18,9 +18,10 @@
"licensecheck": "license-check",
"tsc": "tsc",
"pretest": "npm run build",
"test": "karma start karma.conf.js",
"test": "karma start karma.conf.js --reporters mocha,coverage --single-run",
"test-browser": "karma start karma.conf.js --reporters kjhtml ",
"posttest": "node_modules/.bin/remap-istanbul -i coverage/coverage-final.json -o coverage -t html",
"coverage": "http-server -c-1 -o -p 9875 ./coverage",
"coverage": "http-server -c-1 -o -p 9875 ./coverage/report",
"prepublish": "npm run build"
},
"repository": {
@@ -66,6 +67,7 @@
"karma-coverage": "^1.0.0",
"karma-jasmine": "~1.0.2",
"karma-mocha-reporter": "^2.0.3",
"karma-jasmine-html-reporter": "^0.2.0",
"license-check": "^1.0.4",
"remap-istanbul": "^0.6.3",
"traceur": "^0.0.91",