diff --git a/.travis.yml b/.travis.yml index 148075d82..d767ddad4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,6 @@ sudo: false language: node_js node_js: - - "0.8" - "0.10" - "0.12" - "4.0.0" diff --git a/Makefile b/Makefile index 5046cedf9..da335f66d 100644 --- a/Makefile +++ b/Makefile @@ -1,15 +1,8 @@ -TESTS = test/*.js BENCHMARKS = $(shell find bench -type f ! -name 'runner.js') -REPORTER = dot test: - @./node_modules/.bin/mocha \ - --reporter $(REPORTER) \ - --slow 500ms \ - --bail \ - --globals ___eio,document \ - $(TESTS) + @./node_modules/.bin/gulp test test-cov: lib-cov EIO_COV=1 $(MAKE) test REPORTER=html-cov > coverage.html diff --git a/gulpfile.js b/gulpfile.js new file mode 100644 index 000000000..06ccc6a95 --- /dev/null +++ b/gulpfile.js @@ -0,0 +1,30 @@ +var gulp = require('gulp'); +var mocha = require('gulp-mocha'); +var babel = require("gulp-babel"); + +var TESTS = 'test/*.js'; +var REPORTER = 'dot'; + +gulp.task("default", ["transpile"]); + +gulp.task('test', function(){ + return gulp.src(TESTS, {read: false}) + .pipe(mocha({ + slow: 500, + reporter: REPORTER, + bail: true + })) + .once('error', function(){ + process.exit(1); + }) + .once('end', function(){ + process.exit(); + }); +}); + +// By default, individual js files are transformed by babel and exported to /dist +gulp.task("transpile", function(){ + return gulp.src(["lib/*.js","lib/transports/*.js"], { base: 'lib' }) + .pipe(babel({ "presets": ["es2015"] })) + .pipe(gulp.dest("dist")); +}); diff --git a/package.json b/package.json index ad6c66274..7d13c915b 100644 --- a/package.json +++ b/package.json @@ -32,14 +32,18 @@ "accepts": "1.1.4" }, "devDependencies": { + "babel-preset-es2015": "6.3.13", "engine.io-client": "1.6.8", "expect.js": "0.2.0", + "gulp": "3.9.0", + "gulp-babel": "6.1.1", + "gulp-mocha": "2.2.0", "mocha": "2.3.4", "s": "0.1.1", "superagent": "0.15.4" }, "scripts": { - "test": "make test" + "test": "./node_modules/.bin/gulp test" }, "repository": { "type": "git",