SBoudrias/gulp-istanbul is a open-source project on GitHub, written primarily in JavaScript. It has 185 stars. Istanbul unit test coverage plugin for gulp.
Snapshot summary built from the project's own GitHub metadata — there's no written TopGit review yet. The page will update automatically when a full review is published.
WHY NO REVIEW YET
TopGit writes full reviews for the most-starred, most-requested repositories. This page is a snapshot until then — see the READ ME tab for the original README in full.
var istanbul = require('gulp-istanbul');
// We'll use mocha in this example, but any test framework will work
var mocha = require('gulp-mocha');
gulp.task('pre-test', function () {
return gulp.src(['lib/**/*.js'])
// Covering files
.pipe(istanbul())
// Force `require` to return covered files
.pipe(istanbul.hookRequire());
});
gulp.task('test', ['pre-test'], function () {
return gulp.src(['test/*.js'])
.pipe(mocha())
// Creating the reports after tests ran
.pipe(istanbul.writeReports())
// Enforce a coverage of at least 90%
.pipe(istanbul.enforceThresholds({ thresholds: { global: 90 } }));
});
Note: Version 4.x.x of gulp-mocha is not supported (see issue #115 for details). In this example, you should use gulp-mocha version 3.0.1 for the time being.
Browser testing
For browser testing, you'll need to write the files covered by istanbul in a directory from where you'll serve these files to the browser running the test. You'll also need a way to extract the value of the coverage variable after the test have runned in the browser.
Browser testing is hard. If you're not sure what to do, then I suggest you take a look at Karma test runner - it has built-in coverage using Istanbul.
var istanbul = require('gulp-istanbul');
gulp.task('pre-test', function () {
return gulp.src(['lib/**/*.js'])
// Covering files
.pipe(istanbul())
// Write the covered files to a temporary directory
.pipe(gulp.dest('test-tmp/'));
});
gulp.task('test', ['pre-test'], function () {
// Make sure your tests files are requiring files from the
// test-tmp/ directory
return gulp.src(['test/*.js'])
.pipe(testFramework())
// Creating the reports after tests ran
.pipe(istanbul.writeReports());
});
Source Maps
gulp-istanbul supports gulp-sourcemaps when instrumenting:
gulp.task('pre-test', function () {
return gulp.src(['lib/**/*.js'])
// optionally load existing source maps
.pipe(sourcemaps.init())
// Covering files
.pipe(istanbul())
.pipe(sourcemaps.write('.'))
// Write the covered files to a temporary directory
.pipe(gulp.dest('test-tmp/'));
});
watermarks can be used to confgure the color of the HTML report.
Default colors are.. RED: below 50% coverage, YELLOW: 50-80% coverage, GREEN: above 80%
coverageVariable
Type: String (optional)
Default: '$$cov_' + new Date().getTime() + '$$'
The global variable istanbul uses to store coverage
See also:
istanbul coverageVariable
SanboxedModule
istanbul.enforceThresholds(opt)
Checks coverage against minimum acceptable thresholds. Fails the build if any of the thresholds are not met.
Does SBoudrias/gulp-istanbul have a project website?
No homepage URL was recorded for SBoudrias/gulp-istanbul in TopGit's last sync. The README tab above frequently contains screenshots and demo links, or check the repository description on GitHub.
Is SBoudrias/gulp-istanbul open source?
Yes — SBoudrias/gulp-istanbul ships under the MIT license, which makes its source code freely readable (and, depending on license terms, forkable and reusable). Source: github.com/SBoudrias/gulp-istanbul.
What is SBoudrias/gulp-istanbul?
SBoudrias/gulp-istanbul (SBoudrias/gulp-istanbul) is a JavaScript project on GitHub. From the project's own README: Istanbul unit test coverage plugin for gulp.
What license does SBoudrias/gulp-istanbul use?
SBoudrias/gulp-istanbul is released under the MIT license. Always verify the LICENSE file directly on GitHub for the authoritative terms — license strings can be edited out of sync with a project's actual stance.
Where do I read more about SBoudrias/gulp-istanbul?
This TopGit page is a snapshot — the READ ME tab shows the project's own README content (links stripped, images preserved). The GitHub repository at github.com/SBoudrias/gulp-istanbul is the definitive source.
Read full README in the tab above.
Still deciding about gulp-istanbul?
One click hands the question to an AI along with this page — see what it says about gulp-istanbul.