jest-message-util
Advanced tools
Comparing version 21.3.0-alpha.eff7a1cf to 21.3.0-beta.3
@@ -16,4 +16,17 @@ 'use strict';Object.defineProperty(exports, "__esModule", { value: true });exports.separateMessageFromStack = exports.formatResultsErrors = exports.formatStackTrace = exports.formatExecError = undefined; | ||
var _micromatch = require('micromatch');var _micromatch2 = _interopRequireDefault(_micromatch); | ||
var _slash = require('slash');var _slash2 = _interopRequireDefault(_slash);function _interopRequireDefault(obj) {return obj && obj.__esModule ? obj : { default: obj };} | ||
var _slash = require('slash');var _slash2 = _interopRequireDefault(_slash); | ||
var _stackUtils = require('stack-utils');var _stackUtils2 = _interopRequireDefault(_stackUtils);function _interopRequireDefault(obj) {return obj && obj.__esModule ? obj : { default: obj };} | ||
let nodeInternals = []; /** | ||
* Copyright (c) 2014-present, Facebook, Inc. All rights reserved. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
* | ||
* | ||
*/try {nodeInternals = _stackUtils2.default.nodeInternals() // this is to have the tests be the same in node 4 and node 6. | ||
// TODO: Remove when we drop support for node 4 | ||
.concat(new RegExp('internal/process/next_tick.js'));} catch (e) {// `StackUtils.nodeInternals()` fails in browsers. We don't need to remove | ||
// node internals in the browser though, so no issue. | ||
} | ||
@@ -29,10 +42,13 @@ | ||
// filter for noisy stack trace lines | ||
/** | ||
* Copyright (c) 2014-present, Facebook, Inc. All rights reserved. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
* | ||
* | ||
*/const JASMINE_IGNORE = /^\s+at(?:(?:.*?vendor\/|jasmine\-)|\s+jasmine\.buildExpectationResult)/;const STACK_TRACE_IGNORE = /^\s+at.*?jest(-.*?)?(\/|\\)(build|node_modules|packages)(\/|\\)/;const TITLE_INDENT = ' ';const MESSAGE_INDENT = ' ';const STACK_INDENT = ' ';const ANCESTRY_SEPARATOR = ' \u203A ';const TITLE_BULLET = _chalk2.default.bold('\u25cf ');const STACK_TRACE_COLOR = _chalk2.default.dim; | ||
const JASMINE_IGNORE = /^\s+at(?:(?:.*?vendor\/|jasmine\-)|\s+jasmine\.buildExpectationResult)/; | ||
const JEST_INTERNALS_IGNORE = /^\s+at.*?jest(-.*?)?(\/|\\)(build|node_modules|packages)(\/|\\)/; | ||
const ANONYMOUS_FN_IGNORE = /^\s+at <anonymous>.*$/; | ||
const ANONYMOUS_PROMISE_IGNORE = /^\s+at (new )?Promise \(<anonymous>\).*$/; | ||
const ANONYMOUS_GENERATOR_IGNORE = /^\s+at Generator.next \(<anonymous>\).*$/; | ||
const TITLE_INDENT = ' '; | ||
const MESSAGE_INDENT = ' '; | ||
const STACK_INDENT = ' '; | ||
const ANCESTRY_SEPARATOR = ' \u203A '; | ||
const TITLE_BULLET = _chalk2.default.bold('\u25cf '); | ||
const STACK_TRACE_COLOR = _chalk2.default.dim; | ||
const STACK_PATH_REGEXP = /\s*at.*\(?(\:\d*\:\d*|native)\)?/; | ||
@@ -111,6 +127,22 @@ const EXEC_ERROR_MESSAGE = 'Test suite failed to run'; | ||
return lines.filter(line => { | ||
const isPath = STACK_PATH_REGEXP.test(line); | ||
if (!isPath) { | ||
if (ANONYMOUS_FN_IGNORE.test(line)) { | ||
return false; | ||
} | ||
if (ANONYMOUS_PROMISE_IGNORE.test(line)) { | ||
return false; | ||
} | ||
if (ANONYMOUS_GENERATOR_IGNORE.test(line)) { | ||
return false; | ||
} | ||
if (nodeInternals.some(internal => internal.test(line))) { | ||
return false; | ||
} | ||
if (!STACK_PATH_REGEXP.test(line)) { | ||
return true; | ||
} | ||
if (JASMINE_IGNORE.test(line)) { | ||
@@ -124,3 +156,11 @@ return false; | ||
return !(STACK_TRACE_IGNORE.test(line) || options.noStackTrace); | ||
if (options.noStackTrace) { | ||
return false; | ||
} | ||
if (JEST_INTERNALS_IGNORE.test(line)) { | ||
return false; | ||
} | ||
return true; | ||
}); | ||
@@ -127,0 +167,0 @@ }; |
{ | ||
"name": "jest-message-util", | ||
"version": "21.3.0-alpha.eff7a1cf", | ||
"version": "21.3.0-beta.3", | ||
"repository": { | ||
@@ -13,4 +13,5 @@ "type": "git", | ||
"micromatch": "^2.3.11", | ||
"slash": "^1.0.0" | ||
"slash": "^1.0.0", | ||
"stack-utils": "^1.0.1" | ||
} | ||
} |
8350
213
4
+ Addedstack-utils@^1.0.1
+ Addedescape-string-regexp@2.0.0(transitive)
+ Addedstack-utils@1.0.5(transitive)