UNPKG

793 BJavaScriptView Raw
1var gulp = require('gulp')
2var karma = require('gulp-karma')
3var istanbul = require('browserify-istanbul')
4var browserify = require('browserify')
5var source = require('vinyl-source-stream')
6var foreach = require('gulp-foreach')
7var babelify = require('babelify')
8
9gulp.task('test-browser', function() {
10 return gulp.src('./test/spec/**/*.spec.js')
11 .pipe(foreach(function (stream, file) {
12 return browserify(file.path, {
13 debug: true,
14 insertGlobals: false,
15 detectGlobals: true,
16 noBuiltins: true
17 })
18 .transform(babelify)
19 .transform(istanbul({
20 ignore: ['**/node_modules/**', '**/test/**'],
21 defaultIgnore: true
22 }))
23 .bundle()
24 .pipe(source(file.path))
25 }))
26 .pipe(gulp.dest('./.tmp'))
27 .pipe(karma({
28 configFile: 'karma.conf.js'
29 }))
30})