Skip to content

Commit

Permalink
Added forwarding of stack traces from React.NET console mock (#419)
Browse files Browse the repository at this point in the history
* Added forwarding of stack traces from React.NET console mock

* Use JSON encoding to simplify stack trace handling
  • Loading branch information
Halstatt authored and Daniel15 committed Jul 2, 2017
1 parent e6ce44a commit ec630a5
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/React.Core/Resources/shims.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,15 @@ MockConsole.prototype = {
for (var i = 1; i < arguments.length; i++) {
serializedArgs.push(JSON.stringify(arguments[i]));
}

this._calls.push({
method: methodName,
args: serializedArgs
args: serializedArgs,
stack: '\nCall stack: ' + (new Error().stack || 'not available')
});
},
_formatCall: function(call) {
return 'console.' + call.method + '("[.NET]", ' + call.args.join(', ') + ');';
return 'console.' + call.method + '("[.NET]", ' + call.args.join(', ') + ', ' + JSON.stringify(call.stack) + ');';
},
getCalls: function() {
return this._calls.map(this._formatCall).join('\n');
Expand Down

0 comments on commit ec630a5

Please sign in to comment.