{"id":20079,"library":"gulp-babel-istanbul","title":"gulp-babel-istanbul","description":"A gulp plugin that instruments source files with Istanbul code coverage after Babel transpilation, enabling ES2015+ coverage reporting. Version 1.6.0 (latest) uses babel-istanbul under the hood. It integrates with any Node.js test framework via gulp, providing hooks for require and reports. Compared to alternatives like gulp-istanbul, it natively handles Babel-transpiled code. Browser testing is untested. Requires gulp, babel, and Istanbul. Slow release cadence; last update 2016. Consider seamless builds with webpack or karma for browser coverage.","status":"maintenance","version":"1.6.0","language":"javascript","source_language":"en","source_url":"git://github.com/cb1kenobi/gulp-babel-istanbul","tags":["javascript","gulpplugin","coverage","istanbul","unit test","babel"],"install":[{"cmd":"npm install gulp-babel-istanbul","lang":"bash","label":"npm"},{"cmd":"yarn add gulp-babel-istanbul","lang":"bash","label":"yarn"},{"cmd":"pnpm add gulp-babel-istanbul","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"gulp plugin","package":"gulp","optional":false},{"reason":"Babel transpilation dependency","package":"babel-core","optional":false},{"reason":"core coverage instrumenter","package":"istanbul","optional":false}],"imports":[{"note":"Default export is the istanbul function. CommonJS require is fine.","wrong":"const istanbul = require('gulp-babel-istanbul').default","symbol":"istanbul","correct":"import istanbul from 'gulp-babel-istanbul'"},{"note":"Available as named export from the same module.","wrong":"require('gulp-babel-istanbul').hookRequire","symbol":"hookRequire","correct":"import { hookRequire } from 'gulp-babel-istanbul'"},{"note":"writeReports is a named export, not a method on the default export.","wrong":"istanbul.writeReports()","symbol":"writeReports","correct":"import { writeReports } from 'gulp-babel-istanbul'"}],"quickstart":{"code":"const gulp = require('gulp');\nconst babel = require('gulp-babel');\nconst istanbul = require('gulp-babel-istanbul');\nconst mocha = require('gulp-mocha');\n\ngulp.task('coverage', function (cb) {\n  gulp.src('src/**/*.js')\n    .pipe(istanbul())\n    .pipe(istanbul.hookRequire())\n    .on('finish', function () {\n      gulp.src('test/**/*.js')\n        .pipe(babel())\n        .pipe(mocha())\n        .pipe(istanbul.writeReports())\n        .pipe(istanbul.enforceThresholds({ thresholds: { global: 90 } }))\n        .on('end', cb);\n    });\n});","lang":"javascript","description":"Shows complete gulp task for instrumenting ES2015 source, running mocha tests, and generating coverage reports with threshold enforcement."},"warnings":[{"fix":"Call .pipe(istanbul.hookRequire()) before the finish event.","message":"hookRequire must be used in the same stream after istanbul()","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Use Karma with karma-coverage instead for browser coverage.","message":"Browser testing is untested and may not work","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Use gulp-babel with @babel/core and @babel/preset-env; this plugin uses babel-istanbul which may not be updated.","message":"babel-core is replaced by @babel/core","severity":"deprecated","affected_versions":">=1.6.0"},{"fix":"Use CommonJS modules or transpile to CJS before testing.","message":"require hook does not work with ESM modules","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"search_vec":"'1.6.0':24 '2016':76 'altern':50 'babel':3,17,28,59,68,93 'babel-istanbul':27 'babel-transpil':58 'browser':62,85 'build':79 'cadenc':73 'code':14,61 'compar':48 'consid':77 'coverag':15,21,86,89 'enabl':19 'es2015':20 'file':11 'framework':39 'gulp':2,6,41,53,67 'gulp-babel-istanbul':1 'gulp-istanbul':52 'gulpplugin':88 'handl':57 'hood':32 'hook':43 'instrument':9 'integr':34 'istanbul':4,13,29,54,70,90 'javascript':87 'karma':83 'last':74 'latest':25 'like':51 'nativ':56 'node.js':37 'plugin':7 'provid':42 'releas':72 'report':22,47 'requir':45,66 'seamless':78 'slow':71 'sourc':10 'test':38,63,92 'transpil':18,60 'unit':91 'untest':65 'updat':75 'use':26 'version':23 'via':40 'webpack':81","created_at":"2026-04-25T11:21:13.049376+00:00","updated_at":"2026-04-25T11:21:13.049376+00:00","problems":[{"fix":"npm install babel-core@^6 --save-dev","cause":"Plugin expects babel-istanbul but babel-core is not installed or outdated","error":"Error: Cannot find module 'babel/register'"},{"fix":"Use require('gulp-babel-istanbul').hookRequire or import { hookRequire } from 'gulp-babel-istanbul'","cause":"hookRequire is not called on the default export directly","error":"TypeError: istanbul.hookRequire is not a function"},{"fix":"Ensure istanbul() and hookRequire() are applied before running tests","cause":"writeReports expects a coverage variable that may not exist","error":"ENOENT: no such file or directory, open 'coverage/lcov.info'"},{"fix":"Set { includeUntested: true } and ensure hookRequire() is piped","cause":"includeUntested option false by default and require hook not applied","error":"The coverage report is empty"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":"","cli_version":null,"type":"library","homepage":null,"github":"https://github.com/cb1kenobi/gulp-babel-istanbul","docs":null,"changelog":null,"pypi":null,"npm":"https://www.npmjs.com/package/gulp-babel-istanbul","openapi_spec":null,"status_page":null,"smithery":null,"categories":["testing","devops"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-17","next_check":"2026-07-24","install_tag":null}}