[karma] move config into grunt task for client.mocha support

This commit is contained in:
spalger 2015-08-18 15:36:00 -07:00
parent 32c0b1c3ac
commit e5390a66f0
5 changed files with 44 additions and 88 deletions

View file

@ -1,72 +0,0 @@
// Karma configuration
// Generated on Mon Jul 27 2015 04:03:51 GMT-0700 (MST)
module.exports = function (config) {
config.set({
// base path that will be used to resolve all patterns (eg. files, exclude)
basePath: '',
captureTimeout: 30000,
browserNoActivityTimeout: 120000,
// frameworks to use
// available frameworks: https://npmjs.org/browse/keyword/karma-adapter
frameworks: ['mocha'],
// list of files / patterns to load in the browser
files: [
'http://localhost:5610/bundles/commons.bundle.js',
'http://localhost:5610/bundles/tests.bundle.js',
'http://localhost:5610/bundles/commons.style.css',
'http://localhost:5610/bundles/tests.style.css'
],
proxies: {
'/tests/': 'http://localhost:5610/tests/',
'/bundles/': 'http://localhost:5610/bundles/'
},
// test results reporter to use
// possible values: 'dots', 'progress'
// available reporters: https://npmjs.org/browse/keyword/karma-reporter
reporters: ['progress', 'growl'],
// web server port
port: 9876,
// enable / disable colors in the output (reporters and logs)
colors: true,
// level of logging
// possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
logLevel: config.LOG_INFO,
// enable / disable watching file and executing tests whenever any file changes
autoWatch: false,
// start these browsers
// available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
browsers: [
require('os').platform() === 'win32' ? 'IE' : 'Chrome'
],
// Continuous Integration mode
// if true, Karma captures browsers, runs the tests and exits
singleRun: false,
client: {
mocha: {
reporter: 'html', // change Karma's debug.html to the mocha web reporter
timeout: 10000,
slow: 5000
}
}
});
};

View file

@ -150,6 +150,7 @@
"karma-growl-reporter": "^0.1.1",
"karma-ie-launcher": "^0.2.0",
"karma-mocha": "^0.2.0",
"karma-safari-launcher": "^0.1.1",
"libesvm": "^1.0.1",
"license-checker": "^3.1.0",
"load-grunt-config": "^0.7.0",

View file

@ -1,19 +1,44 @@
module.exports = function (grunt) {
return {
dev: {
configFile: 'karma.conf.js',
reporters: 'dots',
browsers: [
'<%= karmaBrowser %>'
]
},
ci: {
singleRun: true,
configFile: 'karma.conf.js',
reporters: 'dots',
browsers: [
'<%= karmaBrowser %>'
]
options: {
// base path that will be used to resolve all patterns (eg. files, exclude)
basePath: '',
captureTimeout: 30000,
browserNoActivityTimeout: 120000,
frameworks: ['mocha'],
port: 9876,
colors: true,
logLevel: grunt.option('debug') || grunt.option('verbose') ? 'DEBUG' : 'INFO',
autoWatch: false,
browsers: ['<%= karmaBrowser %>'],
// available reporters: https://npmjs.org/browse/keyword/karma-reporter
reporters: ['progress', 'growl'],
// list of files / patterns to load in the browser
files: [
'http://localhost:5610/bundles/commons.bundle.js',
'http://localhost:5610/bundles/tests.bundle.js',
'http://localhost:5610/bundles/commons.style.css',
'http://localhost:5610/bundles/tests.style.css'
],
proxies: {
'/tests/': 'http://localhost:5610/tests/',
'/bundles/': 'http://localhost:5610/bundles/'
},
client: {
mocha: {
reporter: 'html', // change Karma's debug.html to the mocha web reporter
timeout: 10000,
slow: 5000
}
}
},
dev: { singleRun: false },
unit: { singleRun: true },
};
};

View file

@ -16,13 +16,14 @@ module.exports = function (grunt) {
'--env.name=development',
'--logging.json=false',
'--optimize.bundleFilter=tests',
'--optimize.lazy=false'
'--plugins.initialize=false'
]
},
devTestServer: {
options: {
wait: false,
ready: /Server running/,
quiet: false,
failOnError: false
},
@ -32,6 +33,7 @@ module.exports = function (grunt) {
'--no-watch',
'--server.port=5610',
'--optimize.lazyPort=5611',
'--optimize.lazyPrebuild=true',
'--logging.json=false',
'--optimize.bundleFilter=tests',
'--plugins.initialize=false'

View file

@ -10,7 +10,7 @@ module.exports = function (grunt) {
grunt.registerTask('test:dev', [
'run:devTestServer',
'run:karmaDev'
'karma:dev'
]);
grunt.registerTask('test', function (subTask) {