Skip to content

Commit 0592eeb

Browse files
BrokenSourceCodeBrokenSourceCode
authored andcommitted
Windows support for the gulp coveralls command
1 parent 4d4f427 commit 0592eeb

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

gulpfile.js

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
const process = require('process');
2+
const path = require('path');
13
const gulp = require('gulp');
24
const uglify = require('gulp-uglify-es').default;
35
const useref = require('gulp-useref');
@@ -13,6 +15,15 @@ const testPath = './test/test.js';
1315
const coverallsCoverageDirPath = './coverage';
1416
const coverallsCoverageLcovPath = `${coverallsCoverageDirPath}/lcov.info`;
1517
const coverallsBinPath = './node_modules/coveralls/bin/coveralls.js';
18+
const coverallsCommand = (process.platform === 'win32')
19+
// Windows (we have to resolve the paths).
20+
? `nyc report --reporter=lcov`
21+
+ ` && type ${path.resolve(coverallsCoverageLcovPath)} | ${path.resolve(coverallsBinPath)}`
22+
+ ` && rmdir /s /q ${path.resolve(coverallsCoverageDirPath)}`
23+
// Linux.
24+
: `nyc report --reporter=lcov`
25+
+ ` && cat ${coverallsCoverageLcovPath} | ${coverallsBinPath}`
26+
+ ` && rm -rf ${coverallsCoverageDirPath}`;
1627

1728
gulp.task('default', (done) => gulp.src([observableSlimPath, proxyPath])
1829
.pipe(babel({
@@ -35,9 +46,7 @@ gulp.task('test', (done) => gulp.src([testPath])
3546
.on('end', done)
3647
);
3748

38-
gulp.task('coveralls', shell.task([
39-
`nyc report --reporter=lcov && cat ${coverallsCoverageLcovPath} | ${coverallsBinPath} && rm -rf ${coverallsCoverageDirPath}`
40-
]));
49+
gulp.task('coveralls', shell.task([coverallsCommand]));
4150

4251
gulp.task('lint', (done) => gulp.src([observableSlimPath, proxyPath, testPath])
4352
.pipe(eslint())

0 commit comments

Comments
 (0)