1 | var gulp = require('gulp')
|
2 | var karma = require('gulp-karma')
|
3 | var istanbul = require('browserify-istanbul')
|
4 | var browserify = require('browserify')
|
5 | var source = require('vinyl-source-stream')
|
6 | var foreach = require('gulp-foreach')
|
7 | var babelify = require('babelify')
|
8 |
|
9 | gulp.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 | })
|