Skip to content

Commit 2e25662

Browse files
committed
Merge pull request #460 from nus-fboa2016-si/refactor
Gulpfile refactoring
2 parents 2c55b27 + 514d9ad commit 2e25662

File tree

2 files changed

+10
-16
lines changed

2 files changed

+10
-16
lines changed

Makefile

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11

2-
REPORTER = dot
3-
42
build: engine.io.js
53

64
engine.io.js:

gulpfile.js

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,7 @@ const BUILD_TARGET_DIR = './';
1818
gulp.task('default', ['build']);
1919

2020
gulp.task('build', function () {
21-
return gulp.src(['lib/*.js', 'lib/transports/*.js'], {
22-
base: 'lib'
23-
})
21+
return gulp.src('lib/**/*.js')
2422
.pipe(webpack(require('./support/webpack.config.js')))
2523
.pipe(gulp.dest(BUILD_TARGET_DIR));
2624
});
@@ -29,9 +27,12 @@ gulp.task('build', function () {
2927
// TESTING
3028
// //////////////////////////////////////
3129

32-
const REPORTER = 'dot';
3330
const TEST_FILE = './test/index.js';
34-
const TEST_SUPPORT_SERVER_FILE = './test/support/server.js';
31+
const MOCHA_OPTS = {
32+
reporter: 'dot',
33+
require: ['./test/support/server.js'],
34+
bail: true
35+
};
3536
const FILES_TO_CLEAN = [
3637
'test/support/public/engine.io.js'
3738
];
@@ -60,11 +61,6 @@ gulp.task('test-node', testNode);
6061
gulp.task('test-zuul', testZuul);
6162

6263
function testNode () {
63-
const MOCHA_OPTS = {
64-
reporter: REPORTER,
65-
require: [TEST_SUPPORT_SERVER_FILE],
66-
bail: true
67-
};
6864
return gulp.src(TEST_FILE, { read: false })
6965
.pipe(mocha(MOCHA_OPTS))
7066
// following lines to fix gulp-mocha not terminating (see gulp-mocha webpage)
@@ -113,16 +109,16 @@ gulp.task('istanbul-pre-test', function () {
113109
});
114110

115111
gulp.task('test-cov', ['istanbul-pre-test'], function () {
116-
return gulp.src(['test/*.js', 'test/support/*.js'])
117-
.pipe(mocha({
118-
reporter: REPORTER
119-
}))
112+
return gulp.src(TEST_FILE)
113+
.pipe(mocha(MOCHA_OPTS))
120114
.pipe(istanbul.writeReports())
121115
.once('error', function (err) {
116+
cleanFiles(FILES_TO_CLEAN);
122117
console.error(err.stack);
123118
process.exit(1);
124119
})
125120
.once('end', function () {
121+
cleanFiles(FILES_TO_CLEAN);
126122
process.exit();
127123
});
128124
});

0 commit comments

Comments
 (0)