Skip to content

Commit 71561b8

Browse files
committed
Proper coveralls setup
1 parent da3d5e6 commit 71561b8

File tree

2 files changed

+22
-14
lines changed

2 files changed

+22
-14
lines changed

gulp/config.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,6 @@ module.exports = {
1414
lib: directory.lib,
1515
test: directory.test,
1616
target: directory.target,
17-
dist: directory.dist
17+
dist: directory.dist,
18+
ceverageMin: 98
1819
};

gulp/tests.js

+20-13
Original file line numberDiff line numberDiff line change
@@ -42,25 +42,32 @@ module.exports = {
4242
process.chdir(target);
4343
var testSrc = prependToAll('..', config.testSources);
4444
var src = prependToAll('..', config.sources);
45-
return gulp.src(testSrc, { read: false })
45+
var stream = gulp.src(testSrc, { read: false })
4646
.pipe(cover.instrument({
4747
pattern: src,
4848
debugDirectory: 'debug'
4949
}))
5050
.pipe(mocha())
51-
.pipe(cover.gather())
52-
.pipe(cover.enforce({
53-
statements: 98,
54-
blocks: 98,
55-
lines: 98,
51+
.pipe(cover.gather());
52+
53+
if (process.env.TRAVIS == 'true') {
54+
stream = stream.pipe(cover.format([
55+
{ reporter: 'lcov' }
56+
]))
57+
.pipe(coveralls());
58+
} else {
59+
stream = stream.pipe(cover.format([
60+
{ reporter: 'html' },
61+
{ reporter: 'json' },
62+
{ reporter: 'lcov' }
63+
]))
64+
.pipe(gulp.dest('reports'));
65+
}
66+
return stream.pipe(cover.enforce({
67+
statements: config.ceverageMin,
68+
blocks: config.ceverageMin,
69+
lines: config.ceverageMin,
5670
}))
57-
.pipe(cover.format([
58-
{ reporter: 'html', outFile: 'coverage.html' },
59-
{ reporter: 'json', outFile: 'coverage.json' },
60-
{ reporter: 'lcov', outFile: 'coverage.lcov' },
61-
]))
62-
.pipe(coveralls())
63-
.pipe(gulp.dest('reports'))
6471
.on('end', function() {
6572
process.chdir(pwd);
6673
});

0 commit comments

Comments
 (0)