Skip to content

Commit

Permalink
feat(test): add support to run tests in web workers
Browse files Browse the repository at this point in the history
  • Loading branch information
dryajov authored and dignifiedquire committed Jan 26, 2017
1 parent 8f06c99 commit 0b7a851
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 1 deletion.
2 changes: 2 additions & 0 deletions bin/test
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ require('../gulp')(gulp, ['test'])

if (args.browser) {
gulp.start('test:browser')
} else if (args.webworker) {
gulp.start('test:webworker')
} else if (args.node) {
gulp.start('test:node')
} else {
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
"karma-firefox-launcher": "^1.0.0",
"karma-mocha": "^1.3.0",
"karma-mocha-own-reporter": "^1.1.2",
"karma-mocha-webworker": "^1.3.0",
"karma-sauce-launcher": "^1.1.0",
"karma-sourcemap-loader": "^0.3.7",
"karma-webpack": "^2.0.1",
Expand Down
1 change: 1 addition & 0 deletions tasks/release/browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ module.exports = (gulp) => {
runSequence.use(gulp)(
'lint',
'test:browser',
'test:webworker',
done
)
})
Expand Down
10 changes: 9 additions & 1 deletion tasks/test/browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ module.exports = (gulp) => {
const sauce = process.env.SAUCE_USERNAME && process.env.TRAVIS

new Server({
configFile: path.join(__dirname, '../../config/karma.conf.js'),
configFile: path.join(__dirname, webWorker
? '../../config/karma.webworker.conf.js'
: '../../config/karma.conf.js'),
singleRun: !debug
}, (code) => {
if (sauce) {
Expand All @@ -25,4 +27,10 @@ module.exports = (gulp) => {
gulp.task('test:browser', (done) => {
utils.hooksRun(gulp, 'test:browser', ['karma'], utils.exitOnFail(done))
})

let webWorker = false
gulp.task('test:webworker', (done) => {
webWorker = true
utils.hooksRun(gulp, 'test:browser', ['karma'], utils.exitOnFail(done))
})
}

0 comments on commit 0b7a851

Please sign in to comment.