Skip to content
This repository has been archived by the owner on Mar 1, 2024. It is now read-only.

Commit

Permalink
Merge pull request #29 from EDMdesigner/istanbul
Browse files Browse the repository at this point in the history
add: istanbul coverage tool #28
  • Loading branch information
gyulanemeth authored Aug 25, 2016
2 parents 07af655 + 3528a88 commit 3fa11be
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 2 deletions.
22 changes: 21 additions & 1 deletion gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ var jscs = require("gulp-jscs");
var jshint = require("gulp-jshint");
var stylish = require("gulp-jscs-stylish");
var jasmine = require("gulp-jasmine");
var istanbul = require("gulp-istanbul");
var jsonlint = require("gulp-jsonlint");
var browserify = require("browserify");
var partialify = require("partialify");
Expand All @@ -11,6 +12,7 @@ var source = require("vinyl-source-stream");
var jsFiles = [
"./**/*.js",
"!node_modules/**/*",
"!coverage/**/*",
"!examples/**/node_modules/**/*",
"!*/**/*.json",
"!./**/*.built.js",
Expand All @@ -21,6 +23,7 @@ var jsonFiles = [
".jshintrc",
".jscsrc",
"!node_modules/**/*",
"!coverage/**/*",
"./**/*.json"
];

Expand Down Expand Up @@ -65,6 +68,23 @@ gulp.task("jasmine", function() {
}));
});

gulp.task("pre-test", function () {
return gulp.src(["src/**/*.js"])
// Covering files
.pipe(istanbul())
// Force `require` to return covered files
.pipe(istanbul.hookRequire());
});

gulp.task("istanbul", ["pre-test"], function () {
return gulp.src(["spec/**/*.js"])
.pipe(jasmine())
// Creating the reports after tests ran
.pipe(istanbul.writeReports())
// Enforce a coverage of at least 90%
.pipe(istanbul.enforceThresholds({ thresholds: { global: 50 } }));
});

gulp.task("js:prod", createBrowserifyTask({
entries: ["./src/superData.js"],
outputFileName: "superdata.js",
Expand Down Expand Up @@ -163,4 +183,4 @@ gulp.task("watch-test", function() {
gulp.watch(jsFiles, ["jasmine"]);
});

gulp.task("test", ["jsonlint", "jshint", "jscs", "jasmine"]);
gulp.task("test", ["jsonlint", "jshint", "jscs", "istanbul"]);
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "0.1.12",
"version": "0.1.13",
"name": "superdata",
"description": "A ligth weight data layer module motivated by extjs' data layer. It can be used with any client-side framework.",
"main": "src/superData.js",
Expand Down Expand Up @@ -56,11 +56,13 @@
"express": "*",
"express-logger": "*",
"gulp-brfs": "0.1.0",
"gulp-istanbul": "^1.1.0",
"gulp-jasmine": "2.4.0",
"gulp-jscs": "3.0.2",
"gulp-jscs-stylish": "1.3.0",
"gulp-jshint": "2.0.0",
"gulp-jsonlint": "1.1.2",
"istanbul": "^0.4.5",
"jasmine-expect": "1.22.3",
"jasmine-reporters": "2.1.1",
"jshint": "2.9.1",
Expand Down

0 comments on commit 3fa11be

Please sign in to comment.