Skip to content

Commit b945b16

Browse files
committed
Simplify/modernize test run and code coverage calculations.
1 parent 87a7623 commit b945b16

File tree

5 files changed

+202
-2068
lines changed

5 files changed

+202
-2068
lines changed

.travis.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,10 @@ node_js:
44
before_script:
55
- npm install
66
script:
7-
- gulp test
8-
- gulp lint
9-
- gulp coveralls
7+
- npm run test
8+
- npm run lint
9+
after_success:
10+
- npm run coverage
1011
cache:
1112
directories:
1213
- "node_modules"

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,4 +249,4 @@ Array mutations **can** be observed through the use of the array mutation method
249249

250250
## Contributing
251251

252-
Contributions are most welcome! Please be sure to run `gulp test` and `gulp lint` against your code before submitting a pull request.
252+
Contributions are most welcome! Please be sure to run `npm run test` and `npm run lint` against your code before submitting a pull request.

gulpfile.js

Lines changed: 1 addition & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,10 @@
1-
const process = require('process');
2-
const path = require('path');
31
const gulp = require('gulp');
42
const uglify = require('gulp-uglify-es').default;
53
const useref = require('gulp-useref');
64
const rename = require('gulp-rename');
7-
const mocha = require('gulp-mocha');
85
const babel = require('gulp-babel');
9-
const eslint = require('gulp-eslint');
10-
const shell = require('gulp-shell');
116

12-
const observableSlimPath = './observable-slim.js';
13-
const proxyPath = './proxy.js';
14-
const testPath = './test/test.js';
15-
const coverallsCoverageDirPath = './coverage';
16-
const coverallsCoverageLcovPath = `${coverallsCoverageDirPath}/lcov.info`;
17-
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}`;
27-
28-
gulp.task('default', (done) => gulp.src([observableSlimPath, proxyPath])
7+
gulp.task('default', (done) => gulp.src(['./observable-slim.js', './proxy.js'])
298
.pipe(babel({
309
presets: ['@babel/preset-env'],
3110
sourceType: 'script' // Prevent insertion of "use strict".
@@ -38,19 +17,3 @@ gulp.task('default', (done) => gulp.src([observableSlimPath, proxyPath])
3817
.pipe(gulp.dest('./')) // Write it to the current directory.
3918
.on('end', done)
4019
);
41-
42-
gulp.task('test', (done) => gulp.src([testPath])
43-
.pipe(mocha({
44-
compilers: babel
45-
}))
46-
.on('end', done)
47-
);
48-
49-
gulp.task('coveralls', shell.task([coverallsCommand]));
50-
51-
gulp.task('lint', (done) => gulp.src([observableSlimPath, proxyPath, testPath])
52-
.pipe(eslint())
53-
.pipe(eslint.format())
54-
.pipe(eslint.failOnError()) // Brick on failure to be super strict.
55-
.on('end', done)
56-
);

0 commit comments

Comments
 (0)