jest-message-util
Advanced tools
Comparing version 22.2.0 to 22.4.0
@@ -47,2 +47,5 @@ 'use strict';Object.defineProperty(exports, "__esModule", { value: true });exports.separateMessageFromStack = exports.formatResultsErrors = exports.formatStackTrace = exports.formatExecError = undefined; | ||
const PATH_NODE_MODULES = `${_path2.default.sep}node_modules${_path2.default.sep}`; | ||
const PATH_EXPECT_BUILD = `${_path2.default.sep}expect${_path2.default.sep}build${_path2.default.sep}`; | ||
// filter for noisy stack trace lines | ||
@@ -65,3 +68,3 @@ const JASMINE_IGNORE = /^\s+at(?:(?:.*?vendor\/|jasmine\-)|\s+jasmine\.buildExpectationResult)/; | ||
const trim = string => (string || '').replace(/^\s+/, '').replace(/\s+$/, ''); | ||
const trim = string => (string || '').trim(); | ||
@@ -220,2 +223,18 @@ // Some errors contain not only line numbers in stack traces | ||
const getTopFrame = lines => { | ||
for (const line of lines) { | ||
if (line.includes(PATH_NODE_MODULES) || line.includes(PATH_EXPECT_BUILD)) { | ||
continue; | ||
} | ||
const parsedFrame = stackUtils.parseLine(line.trim()); | ||
if (parsedFrame && parsedFrame.file) { | ||
return parsedFrame; | ||
} | ||
} | ||
return null; | ||
}; | ||
const formatStackTrace = exports.formatStackTrace = ( | ||
@@ -234,14 +253,4 @@ stack, | ||
const topFrame = lines. | ||
map(line => line.trim()). | ||
filter(Boolean). | ||
filter( | ||
line => | ||
!line.includes(`${_path2.default.sep}node_modules${_path2.default.sep}`) && | ||
!line.includes(`${_path2.default.sep}expect${_path2.default.sep}build${_path2.default.sep}`)). | ||
const topFrame = getTopFrame(lines); | ||
map(line => stackUtils.parseLine(line)). | ||
filter(Boolean). | ||
filter(parsedFrame => parsedFrame.file)[0]; | ||
if (topFrame) { | ||
@@ -264,5 +273,7 @@ const filename = topFrame.file; | ||
const stacktrace = lines. | ||
map(trimPaths). | ||
map(formatPaths.bind(null, config, options, relativeTestPath)). | ||
map(line => STACK_INDENT + line). | ||
map( | ||
line => | ||
STACK_INDENT + | ||
formatPaths(config, options, relativeTestPath, trimPaths(line))). | ||
join('\n'); | ||
@@ -269,0 +280,0 @@ |
{ | ||
"name": "jest-message-util", | ||
"version": "22.2.0", | ||
"version": "22.4.0", | ||
"repository": { | ||
@@ -5,0 +5,0 @@ "type": "git", |
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
10378
267