making karma logs cleaner by limiting stack trace and browser log
This commit is contained in:
28
common/static/common/js/jasmine_stack_trace.js
Normal file
28
common/static/common/js/jasmine_stack_trace.js
Normal file
@@ -0,0 +1,28 @@
|
||||
/* This file overrides ExceptionFormatter of jasmine before it's initialization in karma-jasmine's
|
||||
boot.js. It's important because ExceptionFormatter returns a constructor function. Once the method has been
|
||||
initialized we can't override the ExceptionFormatter as Jasmine then uses the stored reference to the function */
|
||||
(function () {
|
||||
/* globals jasmineRequire */
|
||||
'use strict';
|
||||
|
||||
var OldExceptionFormatter = jasmineRequire.ExceptionFormatter(),
|
||||
oldExceptionFormatter = new OldExceptionFormatter(),
|
||||
MAX_STACK_TRACE_LINES = 10;
|
||||
|
||||
jasmineRequire.ExceptionFormatter = function () {
|
||||
function ExceptionFormatter() {
|
||||
this.message = oldExceptionFormatter.message;
|
||||
this.stack = function (error) {
|
||||
var errorMsg = null;
|
||||
|
||||
if (error) {
|
||||
errorMsg = error.stack.split('\n').slice(0, MAX_STACK_TRACE_LINES).join('\n');
|
||||
}
|
||||
|
||||
return errorMsg;
|
||||
};
|
||||
}
|
||||
|
||||
return ExceptionFormatter;
|
||||
};
|
||||
}());
|
||||
@@ -84,7 +84,7 @@ function junitNameFormatter(browser, result) {
|
||||
* @return {String}
|
||||
*/
|
||||
function junitClassNameFormatter(browser) {
|
||||
return "Javascript." + browser.name.split(" ")[0];
|
||||
return 'Javascript.' + browser.name.split(' ')[0];
|
||||
}
|
||||
|
||||
|
||||
@@ -227,6 +227,7 @@ var getBaseConfig = function (config, useRequireJs) {
|
||||
var files = [
|
||||
'node_modules/jquery/dist/jquery.js',
|
||||
'node_modules/jasmine-core/lib/jasmine-core/jasmine.js',
|
||||
'common/static/common/js/jasmine_stack_trace.js',
|
||||
'node_modules/karma-jasmine/lib/boot.js',
|
||||
'node_modules/karma-jasmine/lib/adapter.js',
|
||||
'node_modules/jasmine-jquery/lib/jasmine-jquery.js'
|
||||
@@ -292,6 +293,12 @@ var getBaseConfig = function (config, useRequireJs) {
|
||||
// karma-reporter
|
||||
reporters: reporters(config),
|
||||
|
||||
// Spec Reporter configuration
|
||||
specReporter: {
|
||||
maxLogLines: 5,
|
||||
showSpecTiming: true
|
||||
},
|
||||
|
||||
|
||||
coverageReporter: coverageSettings(config),
|
||||
|
||||
@@ -330,7 +337,11 @@ var getBaseConfig = function (config, useRequireJs) {
|
||||
// how many browser should be started simultaneous
|
||||
concurrency: Infinity,
|
||||
|
||||
browserNoActivityTimeout: 50000
|
||||
browserNoActivityTimeout: 50000,
|
||||
|
||||
client: {
|
||||
captureConsole: false
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user