Add coverage tracking in nodejs + coveralls support
This commit is contained in:
1 parent
fa4b6c4f61
commit
38c6cc6eef
5 files changed
+59
-6
No files matched your search
@@ -10,3 +10,5 @@ dist/
|
|||||||
*.env
|
*.env
|
||||||
coverage/
|
coverage/
|
||||||
npm-debug.log
|
npm-debug.log
|
||||||
|
test-dist/
|
||||||
|
coverage-dist/
|
||||||
@@ -12,8 +12,10 @@ addons:
|
|||||||
firefox: latest
|
firefox: latest
|
||||||
script:
|
script:
|
||||||
- npm test
|
- npm test
|
||||||
|
- npm run cover
|
||||||
- npm run browser-test
|
- npm run browser-test
|
||||||
- npm run lint
|
- npm run lint
|
||||||
|
- ./ci/coveralls.sh
|
||||||
git:
|
git:
|
||||||
depth: 1
|
depth: 1
|
||||||
submodules: false
|
submodules: false
|
||||||
|
|||||||
Executable
+2
@@ -0,0 +1,2 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
cat ./coverage/lcov.info | $(npm bin)/coveralls || true
|
||||||
+46
-5
@@ -2,16 +2,46 @@ var gulp = require("gulp");
|
|||||||
var ts = require("gulp-typescript");
|
var ts = require("gulp-typescript");
|
||||||
var tslint = require("gulp-tslint");
|
var tslint = require("gulp-tslint");
|
||||||
var jasmine = require("gulp-jasmine");
|
var jasmine = require("gulp-jasmine");
|
||||||
|
var sourcemaps = require('gulp-sourcemaps');
|
||||||
|
var istanbul = require("gulp-istanbul");
|
||||||
|
var remapIstanbul = require("remap-istanbul/lib/gulpRemapIstanbul");
|
||||||
var tsProject = ts.createProject("tsconfig.json");
|
var tsProject = ts.createProject("tsconfig.json");
|
||||||
|
|
||||||
gulp.task("build", function() {
|
gulp.task("coverage-build", function() {
|
||||||
return tsProject.src()
|
return tsProject.src()
|
||||||
|
.pipe(sourcemaps.init())
|
||||||
.pipe(tsProject())
|
.pipe(tsProject())
|
||||||
.js.pipe(gulp.dest("dist"));
|
.js.pipe(sourcemaps.write('.', {includeContent: false}))
|
||||||
|
.pipe(gulp.dest("coverage-dist"));
|
||||||
});
|
});
|
||||||
|
|
||||||
gulp.task('test', ['build'], function() {
|
gulp.task("pre-coverage", ["coverage-build"], function() {
|
||||||
return gulp.src("dist/*.spec.js").pipe(jasmine());
|
return gulp.src(["coverage-dist/**/*.js"])
|
||||||
|
.pipe(istanbul())
|
||||||
|
.pipe(istanbul.hookRequire());
|
||||||
|
});
|
||||||
|
|
||||||
|
gulp.task('coverage', ['coverage-build', 'pre-coverage'], function() {
|
||||||
|
return gulp.src("coverage-dist/*.spec.js")
|
||||||
|
.pipe(jasmine())
|
||||||
|
.pipe(istanbul.writeReports({
|
||||||
|
dir: './coverage',
|
||||||
|
reporters: ['json'],
|
||||||
|
reportOpts: {
|
||||||
|
json: {dir: './coverage', file: 'coverage-js.json'}
|
||||||
|
}
|
||||||
|
})).on("end", function () {
|
||||||
|
return gulp.src('coverage/coverage-js.json')
|
||||||
|
.pipe(remapIstanbul({
|
||||||
|
basePath: 'src/',
|
||||||
|
reports: {
|
||||||
|
'json': './coverage/coverage.json',
|
||||||
|
'html': './coverage/html-report',
|
||||||
|
'lcovonly': './coverage/lcov.info',
|
||||||
|
'text': null
|
||||||
|
}
|
||||||
|
}));
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
gulp.task('lint', function() {
|
gulp.task('lint', function() {
|
||||||
@@ -20,4 +50,15 @@ gulp.task('lint', function() {
|
|||||||
.pipe(tslint.report());
|
.pipe(tslint.report());
|
||||||
});
|
});
|
||||||
|
|
||||||
gulp.task('default', ['build', 'test', 'lint'])
|
gulp.task('test-build', function() {
|
||||||
|
return tsProject.src()
|
||||||
|
.pipe(tsProject())
|
||||||
|
.pipe(gulp.dest("test-dist"));
|
||||||
|
});
|
||||||
|
|
||||||
|
gulp.task('test', ['test-build'], function() {
|
||||||
|
return gulp.src("test-dist/*.spec.js")
|
||||||
|
.pipe(jasmine());
|
||||||
|
});
|
||||||
|
|
||||||
|
gulp.task('default', ['test', 'lint', 'coverage'])
|
||||||
+7
-1
@@ -12,6 +12,7 @@
|
|||||||
"gulp": "^3.9.1",
|
"gulp": "^3.9.1",
|
||||||
"gulp-tslint": "^8.1.2",
|
"gulp-tslint": "^8.1.2",
|
||||||
"gulp-typescript": "^3.2.3",
|
"gulp-typescript": "^3.2.3",
|
||||||
|
"gulp-sourcemaps": "^2.6.4",
|
||||||
"tslint": "^5.8.0",
|
"tslint": "^5.8.0",
|
||||||
"typescript": "^2.6.2",
|
"typescript": "^2.6.2",
|
||||||
"webpack": "^3.10.0",
|
"webpack": "^3.10.0",
|
||||||
@@ -22,11 +23,16 @@
|
|||||||
"karma-sauce-launcher": "^1.2.0",
|
"karma-sauce-launcher": "^1.2.0",
|
||||||
"karma-webpack": "^2.0.9",
|
"karma-webpack": "^2.0.9",
|
||||||
"karma-sourcemap-loader": "^0.3.7",
|
"karma-sourcemap-loader": "^0.3.7",
|
||||||
"ts-loader": "^3.3.1"
|
"ts-loader": "^3.3.1",
|
||||||
|
"istanbul": "^0.4.5",
|
||||||
|
"gulp-istanbul": "^1.1.3",
|
||||||
|
"remap-istanbul": "^0.10.1",
|
||||||
|
"coveralls": "^3.0.0"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "gulp test",
|
"test": "gulp test",
|
||||||
"lint": "gulp lint",
|
"lint": "gulp lint",
|
||||||
|
"cover": "gulp coverage",
|
||||||
"browser-test": "karma start"
|
"browser-test": "karma start"
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
|
|||||||
Reference in new issue
Block a user