jest-message-util
Advanced tools
Comparing version 22.1.0 to 22.2.0
@@ -73,2 +73,18 @@ 'use strict';Object.defineProperty(exports, "__esModule", { value: true });exports.separateMessageFromStack = exports.formatResultsErrors = exports.formatStackTrace = exports.formatExecError = undefined; | ||
const getRenderedCallsite = (fileContent, line) => { | ||
let renderedCallsite = (0, _codeFrame.codeFrameColumns)( | ||
fileContent, | ||
{ start: { line } }, | ||
{ highlightCode: true }); | ||
renderedCallsite = renderedCallsite. | ||
split('\n'). | ||
map(line => MESSAGE_INDENT + line). | ||
join('\n'); | ||
renderedCallsite = `\n${renderedCallsite}\n`; | ||
return renderedCallsite; | ||
}; | ||
// ExecError is an error thrown outside of the test suite (not inside an `it` or | ||
@@ -232,16 +248,11 @@ // `before/after each` hooks). If it's thrown, none of the tests in the file | ||
if (_path2.default.isAbsolute(filename)) { | ||
renderedCallsite = (0, _codeFrame.codeFrameColumns)( | ||
_fs2.default.readFileSync(filename, 'utf8'), | ||
{ | ||
start: { line: topFrame.line } }, | ||
{ highlightCode: true }); | ||
renderedCallsite = renderedCallsite. | ||
split('\n'). | ||
map(line => MESSAGE_INDENT + line). | ||
join('\n'); | ||
renderedCallsite = `\n${renderedCallsite}\n`; | ||
let fileContent; | ||
try { | ||
// TODO: check & read HasteFS instead of reading the filesystem: | ||
// see: https://github.com/facebook/jest/pull/5405#discussion_r164281696 | ||
fileContent = _fs2.default.readFileSync(filename, 'utf8'); | ||
renderedCallsite = getRenderedCallsite(fileContent, topFrame.line); | ||
} catch (e) { | ||
// the file does not exist or is inaccessible, we ignore | ||
} | ||
} | ||
@@ -248,0 +259,0 @@ } |
{ | ||
"name": "jest-message-util", | ||
"version": "22.1.0", | ||
"version": "22.2.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
10254
261