forked from negomi/react-burger-menu
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.js
More file actions
28 lines (25 loc) · 782 Bytes
/
test.js
File metadata and controls
28 lines (25 loc) · 782 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
const mocha = require('gulp-mocha');
module.exports = function(gulp, config) {
gulp.task('test', ['build:lib'], function() {
var reporterPos = process.argv.indexOf('--reporter');
var reporter = reporterPos > -1 ? process.argv[reporterPos + 1] : null;
return gulp
.src(config.paths.test, { read: false })
.pipe(
mocha({
reporter: reporter,
require: ['babel-core/register', 'jsdom-global/register']
})
)
.on('error', function(err) {
if (process.argv.includes('watch:tests')) {
this.emit('end');
} else {
process.exit(1);
}
});
});
gulp.task('watch:tests', ['test'], function() {
gulp.watch([config.paths.src, config.paths.test], ['test']);
});
};