Subrahmanyam Mandavilli 2015-12-14 11:30:08 +05:30
Родитель 49f2cd65e4 50a188d035
Коммит 9165f666b6
3 изменённых файлов: 22 добавлений и 9 удалений

Просмотреть файл

@ -3,10 +3,13 @@ var rimraf = require("rimraf");
var tsb = require("gulp-tsb");
var mocha = require("gulp-mocha");
var tslint = require("gulp-tslint");
var istanbul = require("gulp-istanbul");
var path = require("path");
var buildDirectory = "_build";
var sourceFiles = ["src/**/*.ts", "tests/**/*.ts"];
var testFiles = [buildDirectory + "/**/*Tests*.js"];
var jsCoverageDir = path.join(buildDirectory, "codecoverage");
// create and keep compiler
var compilation = tsb.create({
@ -19,7 +22,9 @@ var compilation = tsb.create({
gulp.task("build", ["lint"], function() {
return gulp.src(sourceFiles, { base: "." })
.pipe(compilation())
.pipe(gulp.dest(buildDirectory));
.pipe(gulp.dest(buildDirectory))
.pipe(istanbul({includeUntested: true}))
.pipe(istanbul.hookRequire());
});
gulp.task("lint", function() {
@ -37,12 +42,22 @@ gulp.task("clean", function(done) {
gulp.task("test", ["build"], function() {
return gulp.src(testFiles, { read: false })
.pipe(mocha());
.pipe(mocha())
.pipe(istanbul.writeReports({
dir: jsCoverageDir,
reportOpts: { dir: jsCoverageDir }
}))
.pipe(istanbul.enforceThresholds({ thresholds: { global: 95 } }));
});
gulp.task("testci", ["build"], function() {
return gulp.src(testFiles, { read: false })
.pipe(mocha({ reporter: 'xunit', reporterOptions: { output: '_build/testTaskMochaTestResult.xml'} }));
.pipe(mocha({ reporter: "xunit", reporterOptions: { output: path.join(buildDirectory, "mochaTestResult.xml") } }))
.pipe(istanbul.writeReports({
dir: jsCoverageDir,
reportOpts: { dir: jsCoverageDir }
}))
.pipe(istanbul.enforceThresholds({ thresholds: { global: 95 } }));
});
gulp.task("watch", function() {
@ -50,4 +65,3 @@ gulp.task("watch", function() {
});
gulp.task("default", ["build"]);

Просмотреть файл

@ -12,6 +12,7 @@
"devDependencies": {
"chai": "^3.4.1",
"gulp": "^3.9.0",
"gulp-istanbul": "^0.10.3",
"gulp-mocha": "^2.1.3",
"gulp-tsb": "^1.7.4",
"gulp-tslint": "^3.5.0",

Просмотреть файл

@ -12,5 +12,3 @@ describe("HelloWorldWriter.Write", () : void => {
});
});
});