Skip to content

Commit

Permalink
Fix #1651: add support for nodejs experimental-modules stacktraces
Browse files Browse the repository at this point in the history
  • Loading branch information
jehon committed Mar 8, 2019
1 parent 239a615 commit d985a24
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions lib/jasmine-core/jasmine.js
Original file line number Diff line number Diff line change
Expand Up @@ -6463,9 +6463,21 @@ getJasmineRequireObj().SpyStrategy = function(j$) {

getJasmineRequireObj().StackTrace = function(j$) {
function StackTrace(error) {
var lines = error.stack
.split('\n')
.filter(function(line) { return line !== ''; });
var lines = [ 'unknown result!' ];
if (Array.isArray(error.stack)) {
/**
* node --experimental-modules (v11.9 at least)
* esm stackstraces are are composed of an array of "CallSite"
*
* TODO: See later if this behavior need to be adapted again
*/
lines = error.stack.map(function(site) { return site.toString(); });
} else {
/* normal handling */
lines = error.stack
.split('\n')
.filter(function(line) { return line !== ''; });
}

var extractResult = extractMessage(error.message, lines);

Expand Down

0 comments on commit d985a24

Please sign in to comment.