1
0
Fork 0
mirror of https://github.com/openstf/stf synced 2025-10-03 17:59:28 +02:00

Karma now works from Gulp.

This commit is contained in:
Gunther Brunner 2014-08-20 20:58:49 +09:00
parent 14ddd14b47
commit f2c00ce016
3 changed files with 15 additions and 16 deletions

View file

@ -12,10 +12,8 @@ var clean = require('gulp-clean')
var protractor = require("gulp-protractor") var protractor = require("gulp-protractor")
var protractorConfig = require('./res/test/protractor.conf.js') var protractorConfig = require('./res/test/protractor.conf.js')
var karma = require('karma').server var karma = require('karma').server
var karmaConfig = require('./res/test/karma.conf.js') var karmaConfig = '/res/test/karma.conf.js'
var stream = require('stream') var stream = require('stream')
var _ = require('lodash')
gulp.task('jshint', function () { gulp.task('jshint', function () {
return gulp.src([ return gulp.src([
@ -45,12 +43,17 @@ gulp.task('lint', ['jshint', 'jsonlint'])
gulp.task('test', ['lint', 'protractor']) gulp.task('test', ['lint', 'protractor'])
gulp.task('build', ['translate', 'webpack:build']) gulp.task('build', ['translate', 'webpack:build'])
gulp.task('karma', function (done) { gulp.task('karma_ci', function (done) {
karma.start(_.assign({}, karmaConfig, {singleRun: true}), done) karma.start({
configFile: __dirname + karmaConfig,
singleRun: true
}, done)
}) })
gulp.task('karma_watch', function (done) { gulp.task('karma', function (done) {
karma.start(karmaConfig, done) karma.start({
configFile: __dirname + karmaConfig
}, done)
}) })
gulp.task('webdriver_update', protractor.webdriver_update) gulp.task('webdriver_update', protractor.webdriver_update)

View file

@ -1,10 +1,11 @@
describe('greeter', function () { describe('greeter', function () {
function greet(str) { function greet(str) {
return 'Helloaw, ' + str return 'Hello, ' + str
} }
it('should say Hello to the World', function () { it('should say Hello to the World', function () {
expect(greet('World')).toEqual('Hello, World!') expect(greet('World!')).toEqual('Hello, World!')
}) })
}) })

View file

@ -1,21 +1,16 @@
// Karma configuration
module.exports = function (config) { module.exports = function (config) {
config.set({ config.set({
// base path, that will be used to resolve files and exclude
//basePath: '',
frameworks: ['jasmine'], frameworks: ['jasmine'],
files: [ files: [
//'test/*Test.*' //'test/*Test.*'
'../app/*-test.js' '../app/*-test.js'
// '../app/**/*.js'
], ],
exclude: [ exclude: [
], ],
preprocessors: { preprocessors: {
// '../app/**/*.js': ['webpack']
'../app/*-test.js': ['webpack'] '../app/*-test.js': ['webpack']
}, },