jest-util
Advanced tools
Comparing version 14.3.1-alpha.410cb91a to 14.3.2-alpha.83c25417
@@ -33,4 +33,3 @@ /** | ||
super(stdout, stderr); | ||
this._formatBuffer = | ||
formatBuffer || ((type, message) => type + ' ' + message); | ||
this._formatBuffer = formatBuffer || ((type, message) => message); | ||
} | ||
@@ -37,0 +36,0 @@ |
@@ -10,6 +10,8 @@ /** | ||
*/ | ||
'use strict'; | ||
'use strict';var _require = | ||
require('./messages');const formatStackTrace = _require.formatStackTrace; | ||
const mocks = require('jest-mock'); | ||
@@ -62,6 +64,8 @@ | ||
constructor(global, maxLoops) { | ||
constructor(global, config, maxLoops) { | ||
this._global = global; | ||
this._config = config; | ||
this._maxLoops = maxLoops || 100000; | ||
this._uuidCounter = 1; | ||
this._maxLoops = maxLoops || 100000; | ||
@@ -131,4 +135,4 @@ this.reset(); | ||
// Used to be called runTicksRepeatedly | ||
runAllTicks() { | ||
this._checkFakeTimers(); | ||
// Only run a generous number of ticks and then bail. | ||
@@ -160,2 +164,3 @@ // This is just to help avoid recursive loops | ||
runAllImmediates() { | ||
this._checkFakeTimers(); | ||
// Only run a generous number of immediates and then bail. | ||
@@ -188,4 +193,4 @@ let i; | ||
// Used to be called runTimersRepeatedly | ||
runAllTimers() { | ||
this._checkFakeTimers(); | ||
this.runAllTicks(); | ||
@@ -223,4 +228,4 @@ this.runAllImmediates(); | ||
// Used to be called runTimersOnce | ||
runOnlyPendingTimers() { | ||
this._checkFakeTimers(); | ||
this._immediates.forEach(this._runImmediate, this); | ||
@@ -233,4 +238,4 @@ const timers = this._timers; | ||
// Use to be runTimersToTime | ||
runTimersToTime(msToRun) { | ||
this._checkFakeTimers(); | ||
// Only run a generous number of timers and then bail. | ||
@@ -340,2 +345,16 @@ // This is jsut to help avoid recursive loops | ||
_checkFakeTimers() { | ||
if (this._global.setTimeout !== this._fakeTimerAPIs.setTimeout) { | ||
this._global.console.warn( | ||
`A function to advance timers was called but the timers API is not ` + | ||
`mocked with fake timers. Call \`jest.useFakeTimers()\` in this test ` + | ||
`or enable fake timers globally by setting \`"timers": "fake"\` in ` + | ||
`the configuration file. This warning is likely a result of a ` + | ||
`default configuration change in Jest 15.\n\n` + | ||
`Release Blog Post: https://facebook.github.io/jest/blog/2016/09/01/jest-15.html\n` + | ||
`Stack Trace:\n` + formatStackTrace(new Error().stack, this._config)); | ||
} | ||
} | ||
_fakeClearTimer(uuid) { | ||
@@ -342,0 +361,0 @@ if (this._timers.hasOwnProperty(uuid)) { |
@@ -13,5 +13,18 @@ /** | ||
const fs = require('fs'); | ||
const Console = require('./Console'); | ||
const FakeTimers = require('./FakeTimers'); | ||
const JasmineFormatter = require('./JasmineFormatter'); | ||
const NullConsole = require('./NullConsole');var _require = | ||
require('./messages');const formatExecError = _require.formatExecError;const formatResultsErrors = _require.formatResultsErrors;const formatStackTrace = _require.formatStackTrace; | ||
const clearLine = require('./clearLine'); | ||
const fileExists = require('jest-file-exists'); | ||
const installCommonGlobals = require('./installCommonGlobals'); | ||
const mkdirp = require('mkdirp'); | ||
const path = require('path'); | ||
const separateMessageFromStack = require('./separateMessageFromStack'); | ||
@@ -52,3 +65,3 @@ const escapePathForRegex = dir => { | ||
let root = cwd; | ||
while (!fs.existsSync(path.join(root, 'package.json'))) { | ||
while (!fileExists(path.join(root, 'package.json'))) { | ||
if (root === '/' || root.match(/^[A-Z]:\\/)) { | ||
@@ -79,18 +92,18 @@ root = cwd; | ||
exports.Console = require('./Console'); | ||
exports.FakeTimers = require('./FakeTimers'); | ||
exports.JasmineFormatter = require('./JasmineFormatter'); | ||
exports.NullConsole = require('./NullConsole'); | ||
exports.clearLine = require('./clearLine'); | ||
exports.createDirectory = createDirectory; | ||
exports.escapePathForRegex = escapePathForRegex; | ||
exports.escapeStrForRegex = escapeStrForRegex; | ||
exports.formatResultsErrors = | ||
require('./formatFailureMessage').formatResultsErrors; | ||
exports.formatExecError = require('./formatFailureMessage').formatExecError; | ||
exports.getPackageRoot = getPackageRoot; | ||
exports.installCommonGlobals = require('./installCommonGlobals'); | ||
exports.replacePathSepForRegex = replacePathSepForRegex; | ||
exports.separateMessageFromStack = require('./separateMessageFromStack'); | ||
exports.warnAboutUnrecognizedOptions = warnAboutUnrecognizedOptions; | ||
module.exports = { | ||
Console, | ||
FakeTimers, | ||
JasmineFormatter, | ||
NullConsole, | ||
clearLine, | ||
createDirectory, | ||
escapePathForRegex, | ||
escapeStrForRegex, | ||
formatStackTrace, | ||
formatResultsErrors, | ||
formatExecError, | ||
getPackageRoot, | ||
installCommonGlobals, | ||
replacePathSepForRegex, | ||
separateMessageFromStack, | ||
warnAboutUnrecognizedOptions }; |
{ | ||
"name": "jest-util", | ||
"version": "14.3.1-alpha.410cb91a", | ||
"version": "14.3.2-alpha.83c25417", | ||
"repository": { | ||
@@ -14,3 +14,4 @@ "type": "git", | ||
"graceful-fs": "^4.1.6", | ||
"jest-mock": "^14.3.1-alpha.410cb91a", | ||
"jest-file-exists": "^14.3.2-alpha.83c25417", | ||
"jest-mock": "^14.3.2-alpha.83c25417", | ||
"mkdirp": "^0.5.1" | ||
@@ -17,0 +18,0 @@ }, |
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
32188
926
0
6
+ Addedjest-file-exists@14.3.2-alpha.83c25417(transitive)
+ Addedjest-mock@14.3.2-alpha.83c25417(transitive)
- Removedjest-mock@14.3.1-alpha.410cb91a(transitive)