Skip to content

Commit 62798e3

Browse files
committed
Use nyc to fix code coverage
1 parent b506021 commit 62798e3

File tree

4 files changed

+2025
-628
lines changed

4 files changed

+2025
-628
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ pids
1111
lib-cov
1212

1313
# Coverage directory used by tools like istanbul
14+
.nyc_output
1415
coverage
1516

1617
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)

gulpfile.js

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
'use strict';
22

3+
var {spawn} = require('child_process');
34
var gulp = require('gulp');
45
var eslint = require('gulp-eslint');
5-
var istanbul = require('gulp-istanbul');
6-
var mocha = require('gulp-mocha');
76
var docs = require('./scripts/docs.js');
87

98

@@ -15,15 +14,13 @@ gulp.task('quality', function() {
1514
});
1615

1716
gulp.task('test', function(cb) {
18-
gulp.src(['index.js', 'rules/**/*.js'])
19-
.pipe(istanbul()) // Covering files
20-
.pipe(istanbul.hookRequire()) // Force `require` to return covered files
21-
.on('finish', function() {
22-
gulp.src(['test/**/*.js'])
23-
.pipe(mocha())
24-
.pipe(istanbul.writeReports()) // Creating the reports after tests runned
25-
.on('end', cb);
26-
});
17+
const cmd = spawn('nyc', [
18+
'--reporter=lcov',
19+
'--reporter=text',
20+
'mocha',
21+
'test/**'
22+
], {stdio: 'inherit', shell: true});
23+
cmd.on('close', cb);
2724
});
2825

2926

0 commit comments

Comments
 (0)