Skip to content

Commit 74b81d4

Browse files
committed
Merge pull request #384 from nus-fboa2016-si/gulp-rebased
Add gulp and babel
2 parents 83bee03 + 292e058 commit 74b81d4

4 files changed

Lines changed: 36 additions & 10 deletions

File tree

.travis.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
sudo: false
22
language: node_js
33
node_js:
4-
- "0.8"
54
- "0.10"
65
- "0.12"
76
- "4.0.0"

Makefile

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,8 @@
11

2-
TESTS = test/*.js
32
BENCHMARKS = $(shell find bench -type f ! -name 'runner.js')
4-
REPORTER = dot
53

64
test:
7-
@./node_modules/.bin/mocha \
8-
--reporter $(REPORTER) \
9-
--slow 500ms \
10-
--bail \
11-
--globals ___eio,document \
12-
$(TESTS)
5+
@./node_modules/.bin/gulp test
136

147
test-cov: lib-cov
158
EIO_COV=1 $(MAKE) test REPORTER=html-cov > coverage.html

gulpfile.js

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
var gulp = require('gulp');
2+
var mocha = require('gulp-mocha');
3+
var babel = require("gulp-babel");
4+
5+
var TESTS = 'test/*.js';
6+
var REPORTER = 'dot';
7+
8+
gulp.task("default", ["transpile"]);
9+
10+
gulp.task('test', function(){
11+
return gulp.src(TESTS, {read: false})
12+
.pipe(mocha({
13+
slow: 500,
14+
reporter: REPORTER,
15+
bail: true
16+
}))
17+
.once('error', function(){
18+
process.exit(1);
19+
})
20+
.once('end', function(){
21+
process.exit();
22+
});
23+
});
24+
25+
// By default, individual js files are transformed by babel and exported to /dist
26+
gulp.task("transpile", function(){
27+
return gulp.src(["lib/*.js","lib/transports/*.js"], { base: 'lib' })
28+
.pipe(babel({ "presets": ["es2015"] }))
29+
.pipe(gulp.dest("dist"));
30+
});

package.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,18 @@
3232
"accepts": "1.1.4"
3333
},
3434
"devDependencies": {
35+
"babel-preset-es2015": "6.3.13",
3536
"engine.io-client": "1.6.8",
3637
"expect.js": "0.2.0",
38+
"gulp": "3.9.0",
39+
"gulp-babel": "6.1.1",
40+
"gulp-mocha": "2.2.0",
3741
"mocha": "2.3.4",
3842
"s": "0.1.1",
3943
"superagent": "0.15.4"
4044
},
4145
"scripts": {
42-
"test": "make test"
46+
"test": "./node_modules/.bin/gulp test"
4347
},
4448
"repository": {
4549
"type": "git",

0 commit comments

Comments
 (0)