test-agent
Advanced tools
Comparing version 0.22.8 to 0.23.0
@@ -13,4 +13,3 @@ (function(window) { | ||
var Base = TestAgent.Mocha.ReporterBase, | ||
exports = window.TestAgent.Mocha, | ||
log = console.log.bind(console); | ||
exports = window.TestAgent.Mocha; | ||
@@ -32,10 +31,7 @@ MochaReporter.console = window.console; | ||
MochaReporter.console.log = function consoleLogShim() { | ||
var args = Array.prototype.slice.call(arguments), | ||
message = TestAgent.format.apply(TestAgent, arguments); | ||
//real console log | ||
log.apply(this, arguments); | ||
function consoleShim(type) { | ||
var args = Array.prototype.slice.call(arguments, 1), | ||
message = TestAgent.format.apply(TestAgent, args); | ||
//for server | ||
// For server | ||
var stack, messages = args.map(function(item) { | ||
@@ -55,3 +51,3 @@ if (!item) { | ||
if (stack) { | ||
//re-orgnaize the stack to exlude the above | ||
// Re-orgnaize the stack to exlude the above | ||
stack = stack.split('\n').map(function(e) { | ||
@@ -65,6 +61,4 @@ return e.trim().replace(/^at /, ''); | ||
//this is temp | ||
var logDetails = {messages: [message], stack: stack }; | ||
var logDetails = { messages: [message], stack: stack }; | ||
if (MochaReporter.testAgentEnvId) { | ||
@@ -75,6 +69,11 @@ logDetails.testAgentEnvId = MochaReporter.testAgentEnvId; | ||
MochaReporter.send( | ||
JSON.stringify(['log', logDetails]) | ||
JSON.stringify([type, logDetails]) | ||
); | ||
}; | ||
MochaReporter.console.log = consoleShim.bind(null, 'log'); | ||
MochaReporter.console.info = consoleShim.bind(null, 'info'); | ||
MochaReporter.console.warn = consoleShim.bind(null, 'warn'); | ||
MochaReporter.console.error = consoleShim.bind(null, 'error'); | ||
runner.on('suite', function onSuite(suite) { | ||
@@ -81,0 +80,0 @@ indentation++; |
@@ -93,4 +93,20 @@ (function() { | ||
if (!this.coverage) { | ||
this.on('log', function onLog(data) { | ||
console.log.apply(console, data.messages); | ||
this.on({ | ||
'log': function onLog(data) { | ||
console.log.apply(console, data.messages); | ||
}, | ||
'info': function onInfo(data) { | ||
console.info.apply(console, data.messages); | ||
}, | ||
'warn': function onWarn(data) { | ||
console.warn.apply(console, data.messages); | ||
}, | ||
'error': function onError(data) { | ||
console.error.apply(console, data.messages); | ||
} | ||
}); | ||
@@ -97,0 +113,0 @@ } |
{ | ||
"name": "test-agent", | ||
"version": "0.22.8", | ||
"version": "0.23.0", | ||
"author": "James Lal", | ||
@@ -5,0 +5,0 @@ "description": "execute client side tests from browser report back to cli", |
Sorry, the diff of this file is too big to display
252277
7864