Skip to content

Add gulp and babel #384

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 12 commits into from
Mar 13, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
sudo: false
language: node_js
node_js:
- "0.8"
- "0.10"
- "0.12"
- "4.0.0"
Expand Down
9 changes: 1 addition & 8 deletions Makefile
Original file line number Diff line number Diff line change
@@ -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
Expand Down
30 changes: 30 additions & 0 deletions gulpfile.js
Original file line number Diff line number Diff line change
@@ -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"));
});
6 changes: 5 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down