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

@@ -36,6 +36,12 @@ npm run build
npm test 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 This task rebuilds all the code, runs tslint, license checks and other quality check tools
before performing unit testing. before performing unit testing.

View File

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

View File

@@ -18,9 +18,10 @@
"licensecheck": "license-check", "licensecheck": "license-check",
"tsc": "tsc", "tsc": "tsc",
"pretest": "npm run build", "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", "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" "prepublish": "npm run build"
}, },
"repository": { "repository": {
@@ -71,6 +72,7 @@
"karma-coverage": "^1.0.0", "karma-coverage": "^1.0.0",
"karma-jasmine": "~1.0.2", "karma-jasmine": "~1.0.2",
"karma-mocha-reporter": "^2.0.3", "karma-mocha-reporter": "^2.0.3",
"karma-jasmine-html-reporter": "^0.2.0",
"license-check": "^1.0.4", "license-check": "^1.0.4",
"remap-istanbul": "^0.6.3", "remap-istanbul": "^0.6.3",
"traceur": "^0.0.91", "traceur": "^0.0.91",

View File

@@ -31,6 +31,12 @@ npm run build
npm test 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 This task rebuilds all the code, runs tslint, license checks and other quality check tools
before performing unit testing. before performing unit testing.

View File

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

View File

@@ -18,9 +18,10 @@
"licensecheck": "license-check", "licensecheck": "license-check",
"tsc": "tsc", "tsc": "tsc",
"pretest": "npm run build", "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", "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" "prepublish": "npm run build"
}, },
"repository": { "repository": {
@@ -66,6 +67,7 @@
"karma-coverage": "^1.0.0", "karma-coverage": "^1.0.0",
"karma-jasmine": "~1.0.2", "karma-jasmine": "~1.0.2",
"karma-mocha-reporter": "^2.0.3", "karma-mocha-reporter": "^2.0.3",
"karma-jasmine-html-reporter": "^0.2.0",
"license-check": "^1.0.4", "license-check": "^1.0.4",
"remap-istanbul": "^0.6.3", "remap-istanbul": "^0.6.3",
"traceur": "^0.0.91", "traceur": "^0.0.91",

View File

@@ -456,6 +456,12 @@ npm run build
npm test 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 This task rebuilds all the code, runs tslint, license checks and other quality check tools
before performing unit testing. before performing unit testing.

View File

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

View File

@@ -18,9 +18,10 @@
"licensecheck": "license-check", "licensecheck": "license-check",
"tsc": "tsc", "tsc": "tsc",
"pretest": "npm run build", "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", "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" "prepublish": "npm run build"
}, },
"repository": { "repository": {
@@ -70,6 +71,7 @@
"karma-coverage": "^1.0.0", "karma-coverage": "^1.0.0",
"karma-jasmine": "~1.0.2", "karma-jasmine": "~1.0.2",
"karma-mocha-reporter": "^2.0.3", "karma-mocha-reporter": "^2.0.3",
"karma-jasmine-html-reporter": "^0.2.0",
"license-check": "^1.0.4", "license-check": "^1.0.4",
"remap-istanbul": "^0.6.3", "remap-istanbul": "^0.6.3",
"traceur": "^0.0.91", "traceur": "^0.0.91",

View File

@@ -163,6 +163,12 @@ npm start
npm test 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 This task rebuilds all the code, runs tslint, license checks and other quality check tools
before performing unit testing. before performing unit testing.

View File

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

View File

@@ -19,9 +19,10 @@
"licensecheck": "license-check", "licensecheck": "license-check",
"tsc": "tsc", "tsc": "tsc",
"pretest": "npm run build", "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", "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" "prepublish": "npm run build"
}, },
"repository": { "repository": {
@@ -80,6 +81,7 @@
"karma-coverage": "^1.0.0", "karma-coverage": "^1.0.0",
"karma-jasmine": "~1.0.2", "karma-jasmine": "~1.0.2",
"karma-mocha-reporter": "^2.0.3", "karma-mocha-reporter": "^2.0.3",
"karma-jasmine-html-reporter": "^0.2.0",
"license-check": "^1.0.4", "license-check": "^1.0.4",
"remap-istanbul": "^0.6.3", "remap-istanbul": "^0.6.3",
"traceur": "^0.0.91", "traceur": "^0.0.91",

View File

@@ -31,6 +31,12 @@ npm run build
npm test npm test
``` ```
## Running unit tests in browser
```sh
npm test-browser
```
#### Basic usage #### Basic usage

View File

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

View File

@@ -17,9 +17,10 @@
"licensecheck": "license-check", "licensecheck": "license-check",
"tsc": "tsc", "tsc": "tsc",
"pretest": "npm run build", "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", "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" "prepublish": "npm run build"
}, },
"repository": { "repository": {
@@ -66,6 +67,7 @@
"karma-coverage": "^1.0.0", "karma-coverage": "^1.0.0",
"karma-jasmine": "~1.0.2", "karma-jasmine": "~1.0.2",
"karma-mocha-reporter": "^2.0.3", "karma-mocha-reporter": "^2.0.3",
"karma-jasmine-html-reporter": "^0.2.0",
"license-check": "^1.0.4", "license-check": "^1.0.4",
"remap-istanbul": "^0.6.3", "remap-istanbul": "^0.6.3",
"traceur": "^0.0.91", "traceur": "^0.0.91",

View File

@@ -197,6 +197,12 @@ bootstrap(MyDemoApp, [
npm test 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 This task rebuilds all the code, runs tslint, license checks and other quality check tools
before performing unit testing. before performing unit testing.

View File

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

View File

@@ -18,9 +18,10 @@
"licensecheck": "license-check", "licensecheck": "license-check",
"tsc": "tsc", "tsc": "tsc",
"pretest": "npm run build", "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", "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" "prepublish": "npm run build"
}, },
"repository": { "repository": {
@@ -74,6 +75,7 @@
"karma-coverage": "^1.0.0", "karma-coverage": "^1.0.0",
"karma-jasmine": "~1.0.2", "karma-jasmine": "~1.0.2",
"karma-jasmine-ajax": "^0.1.13", "karma-jasmine-ajax": "^0.1.13",
"karma-jasmine-html-reporter": "^0.2.0",
"karma-mocha-reporter": "^2.0.3", "karma-mocha-reporter": "^2.0.3",
"license-check": "^1.0.4", "license-check": "^1.0.4",
"remap-istanbul": "^0.6.3", "remap-istanbul": "^0.6.3",

View File

@@ -41,6 +41,12 @@ Method | Parameters | Returns | Description
$ npm run test $ npm run test
``` ```
* To run the test in the browser
```sh
$ npm run test-browser
```
* To run the test coverage * To run the test coverage
```sh ```sh

View File

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

View File

@@ -18,9 +18,10 @@
"licensecheck": "license-check", "licensecheck": "license-check",
"tsc": "tsc", "tsc": "tsc",
"pretest": "npm run build", "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", "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" "prepublish": "npm run build"
}, },
"repository": { "repository": {