Skip to content

Commit bd85ded

Browse files
committed
fix(gulp): make coverage tests work
1 parent 5f2a6cc commit bd85ded

File tree

2 files changed

+16
-8
lines changed

2 files changed

+16
-8
lines changed

Diff for: app/templates/_package.json

+4-2
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,7 @@
4343
"gulp-add-src": "^0.2.0",
4444
"gulp-angular-templatecache": "^1.7.0",
4545
"gulp-autoprefixer": "2.3.1",
46-
"gulp-babel": "^5.1.0",
47-
"gulp-babel-istanbul": "^0.11.0",<% if(filters.ts) { %>
46+
"gulp-babel": "^5.1.0",<% if(filters.ts) { %>
4847
"gulp-typescript": "~2.10.0",
4948
"gulp-tsd": "~0.0.4",
5049
"gulp-tslint": "~4.2.1",<% } %>
@@ -54,6 +53,8 @@
5453
"gulp-filter": "^2.0.2",
5554
"gulp-imagemin": "^2.2.1",
5655
"gulp-inject": "^1.3.1",
56+
"gulp-istanbul": "~0.10.3",
57+
"gulp-istanbul-enforcer": "^1.0.3",
5758
"gulp-jscs": "^3.0.2",
5859
"gulp-jshint": "^1.11.0",
5960
"gulp-livereload": "^3.8.0",
@@ -82,6 +83,7 @@
8283
"gulp-scss-lint": "^0.2.1",<% } if(filters.less) { %>
8384
"gulp-less": "^3.0.3",
8485
"gulp-recess": "^1.1.2",<% } %>
86+
"isparta": "^3.5.3",
8587
"utile": "~0.3.0",
8688
"nodemon": "^1.3.7",
8789
"run-sequence": "^1.1.0",

Diff for: app/templates/gulpfile.babel(gulp).js

+12-6
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ import {stream as wiredep} from 'wiredep';
1313
import nodemon from 'nodemon';
1414
import {Server as KarmaServer} from 'karma';
1515
import runSequence from 'run-sequence';
16-
import {protractor, webdriver_update} from 'gulp-protractor';<% if(filters.stylus) { %>
16+
import {protractor, webdriver_update} from 'gulp-protractor';
17+
import {Instrumenter} from 'isparta';<% if(filters.stylus) { %>
1718
import nib from 'nib';<% } %>
1819

1920
var plugins = gulpLoadPlugins();
@@ -158,16 +159,18 @@ let mocha = lazypipe()
158159
});
159160

160161
let istanbul = lazypipe()
161-
.pipe(plugins.babelIstanbul.writeReports)
162-
.pipe(plugins.babelIstanbul.enforceThresholds, {
162+
.pipe(plugins.istanbul.writeReports)
163+
.pipe(plugins.istanbulEnforcer, {
163164
thresholds: {
164165
global: {
165166
lines: 80,
166167
statements: 80,
167168
branches: 80,
168169
functions: 80
169170
}
170-
}
171+
},
172+
coverageDirectory: './coverage',
173+
rootDirectory : ''
171174
});
172175

173176
/********************
@@ -600,9 +603,12 @@ gulp.task('copy:server', () => {
600603
gulp.task('coverage:pre', () => {
601604
return gulp.src(paths.server.scripts)
602605
// Covering files
603-
.pipe(plugins.babelIstanbul())
606+
.pipe(plugins.istanbul({
607+
instrumenter: Instrumenter, // Use the isparta instrumenter (code coverage for ES6)
608+
includeUntested: true
609+
}))
604610
// Force `require` to return covered files
605-
.pipe(plugins.babelIstanbul.hookRequire());
611+
.pipe(plugins.istanbul.hookRequire());
606612
});
607613

608614
gulp.task('coverage:unit', () => {

0 commit comments

Comments
 (0)