stacktracey
Advanced tools
Comparing version 1.2.111 to 1.2.112
{ | ||
"name": "stacktracey", | ||
"version": "1.2.111", | ||
"version": "1.2.112", | ||
"description": "Parses call stacks. Reads sources. Clean & filtered output. Sourcemaps. Node & browsers.", | ||
@@ -5,0 +5,0 @@ "main": "stacktracey", |
@@ -121,9 +121,10 @@ "use strict"; | ||
native = (planA[2] === 'native') | ||
fileLineColumn = (planA[2].match (/(.*):(.+):(.+)/) || []).slice (1) } | ||
fileLineColumn = (planA[2].match (/(.*):(.+):(.+)/) || []).slice (1) | ||
else if ((planB = line.match (/^(at\s+)*(.+):([0-9]+):([0-9]+)/) )) { | ||
fileLineColumn = (planB).slice (2) } | ||
} else if ((planB = line.match (/^(at\s+)*(.+):([0-9]+):([0-9]+)/) )) { | ||
fileLineColumn = (planB).slice (2) | ||
else { | ||
return undefined } | ||
} else { | ||
return undefined | ||
} | ||
@@ -147,3 +148,5 @@ /* Detect things like Array.reduce | ||
line: parseInt (fileLineColumn[1] || '', 10) || undefined, | ||
column: parseInt (fileLineColumn[2] || '', 10) || undefined } }) | ||
column: parseInt (fileLineColumn[2] || '', 10) || undefined | ||
} | ||
}) | ||
@@ -175,5 +178,11 @@ return entries.filter (x => (x !== undefined)) | ||
if (!resolved.sourceLine.error && resolved.sourceLine.includes ('// @hide')) { | ||
resolved.sourceLine = resolved.sourceLine.replace ('// @hide', '') | ||
resolved.hide = true | ||
if (!resolved.sourceLine.error) { | ||
if (resolved.sourceLine.includes ('// @hide')) { | ||
resolved.sourceLine = resolved.sourceLine.replace ('// @hide', '') | ||
resolved.hide = true | ||
} | ||
if (resolved.sourceLine.includes ('__webpack_require__') || // webpack-specific heuristics | ||
resolved.sourceLine.includes ('/******/ ({')) { | ||
resolved.thirdParty = true | ||
} | ||
} | ||
@@ -196,3 +205,6 @@ | ||
memo.calleeShort = (memo.calleeShort || '<anonymous>') + ' → ' + (entry.calleeShort || '<anonymous>') | ||
return memo }, O.assign ({}, group.items[0])) })) | ||
return memo }, O.assign ({}, group.items[0])) | ||
} | ||
) | ||
) | ||
} | ||
@@ -199,0 +211,0 @@ |
22
test.js
"use strict"; | ||
/* ------------------------------------------------------------------------ */ | ||
const nodeVersion = Math.floor (Number (process.version.match (/^v(\d+\.\d+)/)[1])) | ||
/* ------------------------------------------------------------------------ */ | ||
@@ -37,3 +41,3 @@ require ('chai').should () | ||
stack[0].should.deep.equal ({ | ||
beforeParse: 'at shouldBeVisibleInStackTrace (' + path.join (process.cwd (), 'test.js') + ':28:47)', | ||
beforeParse: 'at shouldBeVisibleInStackTrace (' + path.join (process.cwd (), 'test.js') + ':32:47)', | ||
callee: 'shouldBeVisibleInStackTrace', | ||
@@ -43,3 +47,3 @@ index: false, | ||
file: path.join (process.cwd (), 'test.js').replace (/\\/g, '/'), | ||
line: 28, | ||
line: 32, | ||
column: 47, | ||
@@ -147,3 +151,5 @@ calleeShort: 'shouldBeVisibleInStackTrace', | ||
pretty.split ('\n')[0].should.equal ('at prettyTest test.js:140 const pretty = new StackTracey ().clean.pretty') | ||
const spaces = nodeVersion > 8 ? ' ' : ' '; | ||
pretty.split ('\n')[0].should.equal ('at prettyTest' + spaces + 'test.js:144 const pretty = new StackTracey ().clean.pretty') | ||
}) | ||
@@ -199,3 +205,2 @@ | ||
const nodeVersion = Number (process.version.match(/^v(\d+\.\d+)/)[1]) | ||
if (nodeVersion >= 5) { | ||
@@ -216,3 +221,6 @@ | ||
stack.pretty.split ('\n')[0].should.equal ('at (syntax error) test_files/syntax_error.js:2 foo->bar () ') | ||
const spaces = nodeVersion > 8 ? ' ' : ' ' | ||
const spaces2 = nodeVersion > 8 ? ' ' : ' ' | ||
stack.pretty.split ('\n')[0].should.equal ('at (syntax error)' + spaces + 'test_files/syntax_error.js:2' + spaces2 + 'foo->bar () ') | ||
} | ||
@@ -259,3 +267,3 @@ }) | ||
'Error', | ||
' at Context.it (' + dir + '\\test.js:34:22)', | ||
' at Context.it (' + dir + '\\test.js:38:22)', | ||
' at callFn (' + dir + '\\node_modules\\mocha\\lib\\runnable.js:354:21)', | ||
@@ -272,3 +280,3 @@ ' at runCallback (timers.js:800:20)' | ||
lines[0].should.equal ('at it test.js:34 stack.should.be.an.instanceof (Array)') | ||
lines[0].should.equal ('at it test.js:38 stack.should.be.an.instanceof (Array)') | ||
lines[1].indexOf ('at callFn mocha/lib/runnable.js:354').should.equal (0) | ||
@@ -275,0 +283,0 @@ }) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
37151
429