Socket
Socket
Sign inDemoInstall

jest-util

Package Overview
Dependencies
Maintainers
6
Versions
261
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jest-util - npm Package Compare versions

Comparing version 15.1.1 to 15.2.0-alpha.c681f819

14

build/FakeTimers.js

@@ -15,6 +15,5 @@ /**

require('./messages');const formatStackTrace = _require.formatStackTrace;
const mocks = require('jest-mock');
const fn = impl => mocks.getMockFn().mockImpl(impl);

@@ -46,3 +45,2 @@

const MS_IN_A_YEAR = 31536000000;

@@ -66,3 +64,9 @@

constructor(global, config, maxLoops) {
constructor(
global,
moduleMocker,
config,
maxLoops)
{
this._global = global;

@@ -85,2 +89,4 @@ this._config = config;

const fn = impl => moduleMocker.getMockFn().mockImpl(impl);
this._fakeTimerAPIs = {

@@ -87,0 +93,0 @@ clearImmediate: fn(this._fakeClearImmediate.bind(this)),

@@ -40,3 +40,3 @@ /**

const escapeStrForRegex =
string => string.replace(/[[\]{}()*+?.,\\^$|#\s]/g, '\\$&');
string => string.replace(/[[\]{}()*+?.\\^$|]/g, '\\$&');

@@ -43,0 +43,0 @@ const replacePathSepForRegex = string => {

/**
* Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
*
*/
* Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
*
*/
'use strict';

@@ -34,3 +34,11 @@

// object for the jsdom environment to prevent memory leaks.
global.process = Object.assign({}, process);
// Overwrite toString to make it look like the real process object
let toStringOverwrite;
if (Symbol && Symbol.toStringTag) {
// $FlowFixMe
toStringOverwrite = {
[Symbol.toStringTag]: 'process' };
}
global.process = Object.assign({}, process, toStringOverwrite);
global.process.setMaxListeners = process.setMaxListeners.bind(process);

@@ -37,0 +45,0 @@ global.process.getMaxListeners = process.getMaxListeners.bind(process);

@@ -108,3 +108,7 @@ /**

const formatPaths = (config, relativeTestPath, line) => {
const formatPaths = (
config,
relativeTestPath,
line) =>
{
// Extract the file path from the trace line.

@@ -117,13 +121,23 @@ const match = line.match(/(^\s*at .*?\(?)([^()]+)(:[0-9]+:[0-9]+\)?.*$)/);

let filePath = path.relative(config.rootDir, match[2]);
if (config.testRegex && new RegExp(config.testRegex).test(filePath)) {
filePath = chalk.reset.blue(filePath);
} else if (filePath === relativeTestPath) {
// highlight paths from the current test file
// highlight paths from the current test file
if (
config.testRegex && new RegExp(config.testRegex).test(filePath) ||
filePath === relativeTestPath)
{
filePath = chalk.reset.cyan(filePath);
}
// make paths relative to the <rootDir>
return STACK_TRACE_COLOR(match[1]) + filePath + STACK_TRACE_COLOR(match[3]);
};
const formatStackTrace = (stack, config, testPath) => {
const formatStackTrace = (
stack,
config,
testPath) =>
{
let lines = stack.split(/\n/);

@@ -145,3 +159,3 @@ const relativeTestPath = testPath ?

{
const failedResults = testResults.testResults.reduce(
const failedResults = testResults.reduce(
(errors, result) => {

@@ -148,0 +162,0 @@ result.failureMessages.forEach(content => errors.push({ result, content }));

{
"name": "jest-util",
"version": "15.1.1",
"version": "15.2.0-alpha.c681f819",
"repository": {

@@ -14,9 +14,6 @@ "type": "git",

"graceful-fs": "^4.1.6",
"jest-file-exists": "^15.0.0",
"jest-mock": "^15.0.0",
"jest-file-exists": "^15.2.0-alpha.c681f819",
"jest-mock": "^15.2.0-alpha.c681f819",
"mkdirp": "^0.5.1"
},
"devDependencies": {
"jsdom": "^9.2.1"
},
"scripts": {

@@ -23,0 +20,0 @@ "test": "../../packages/jest-cli/bin/jest.js"

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc