Added logging, changed some directory structure

This commit is contained in:
2018-01-13 21:33:40 -05:00
parent f079a5f067
commit 8e72ffb917
73656 changed files with 35284 additions and 53718 deletions

View File

@@ -0,0 +1,4 @@
**/__mocks__/**
**/__tests__/**
src
yarn.lock

View File

@@ -0,0 +1,60 @@
'use strict';var _getPrototypeOf = require('babel-runtime/core-js/object/get-prototype-of');var _getPrototypeOf2 = _interopRequireDefault(_getPrototypeOf);var _classCallCheck2 = require('babel-runtime/helpers/classCallCheck');var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);var _createClass2 = require('babel-runtime/helpers/createClass');var _createClass3 = _interopRequireDefault(_createClass2);var _possibleConstructorReturn2 = require('babel-runtime/helpers/possibleConstructorReturn');var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);var _get2 = require('babel-runtime/helpers/get');var _get3 = _interopRequireDefault(_get2);var _inherits2 = require('babel-runtime/helpers/inherits');var _inherits3 = _interopRequireDefault(_inherits2);function _interopRequireDefault(obj) {return obj && obj.__esModule ? obj : { default: obj };}var _require =
require('util'),format = _require.format; /**
* 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.
*
*
*/ /* global stream$Writable */var _require2 = require('console'),Console = _require2.Console;var clearLine = require('./clearLine');var CustomConsole = function (_Console) {(0, _inherits3.default)(CustomConsole, _Console);
function CustomConsole(
stdout,
stderr,
formatBuffer)
{(0, _classCallCheck3.default)(this, CustomConsole);var _this = (0, _possibleConstructorReturn3.default)(this, (CustomConsole.__proto__ || (0, _getPrototypeOf2.default)(CustomConsole)).call(this,
stdout, stderr));
_this._formatBuffer = formatBuffer || function (type, message) {return message;};return _this;
}(0, _createClass3.default)(CustomConsole, [{ key: '_log', value: function _log(
type, message) {
clearLine(this._stdout);
(0, _get3.default)(CustomConsole.prototype.__proto__ || (0, _getPrototypeOf2.default)(CustomConsole.prototype), 'log', this).call(this, this._formatBuffer(type, message));
} }, { key: 'log', value: function log()
{
this._log('log', format.apply(null, arguments));
} }, { key: 'info', value: function info()
{
this._log('info', format.apply(null, arguments));
} }, { key: 'warn', value: function warn()
{
this._log('warn', format.apply(null, arguments));
} }, { key: 'error', value: function error()
{
this._log('error', format.apply(null, arguments));
} }, { key: 'getBuffer', value: function getBuffer()
{
return null;
} }]);return CustomConsole;}(Console);
module.exports = CustomConsole;

View File

@@ -0,0 +1,515 @@
'use strict';var _keys = require('babel-runtime/core-js/object/keys');var _keys2 = _interopRequireDefault(_keys);var _classCallCheck2 = require('babel-runtime/helpers/classCallCheck');var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);var _createClass2 = require('babel-runtime/helpers/createClass');var _createClass3 = _interopRequireDefault(_createClass2);function _interopRequireDefault(obj) {return obj && obj.__esModule ? obj : { default: obj };}var _require =
require('jest-message-util'),formatStackTrace = _require.formatStackTrace; /**
* 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.
*
*
*/var setGlobal = require('./setGlobal');
var MS_IN_A_YEAR = 31536000000;var
FakeTimers = function () {
function FakeTimers(
global,
moduleMocker,
config,
maxLoops)
{var _this = this;(0, _classCallCheck3.default)(this, FakeTimers);
this._global = global;
this._config = config;
this._maxLoops = maxLoops || 100000;
this._uuidCounter = 1;
this._moduleMocker = moduleMocker;
// Store original timer APIs for future reference
this._timerAPIs = {
clearImmediate: global.clearImmediate,
clearInterval: global.clearInterval,
clearTimeout: global.clearTimeout,
nextTick: global.process && global.process.nextTick,
setImmediate: global.setImmediate,
setInterval: global.setInterval,
setTimeout: global.setTimeout };
this.reset();
this._createMocks();
// These globally-accessible function are now deprecated!
// They will go away very soon, so do not use them!
// Instead, use the versions available on the `jest` object
global.mockRunTicksRepeatedly = this.runAllTicks.bind(this);
global.mockRunTimersOnce = this.runOnlyPendingTimers.bind(this);
global.mockRunTimersToTime = this.runTimersToTime.bind(this);
global.mockRunTimersRepeatedly = this.runAllTimers.bind(this);
global.mockClearTimers = this.clearAllTimers.bind(this);
global.mockGetTimersCount = function () {return (0, _keys2.default)(_this._timers).length;};
}(0, _createClass3.default)(FakeTimers, [{ key: 'clearAllTimers', value: function clearAllTimers()
{var _this2 = this;
this._immediates.forEach(function (immediate) {return (
_this2._fakeClearImmediate(immediate.uuid));});
for (var _uuid in this._timers) {
delete this._timers[_uuid];
}
} }, { key: 'dispose', value: function dispose()
{
this._disposed = true;
this.clearAllTimers();
} }, { key: 'reset', value: function reset()
{
this._cancelledTicks = {};
this._cancelledImmediates = {};
this._now = 0;
this._ticks = [];
this._immediates = [];
this._timers = {};
} }, { key: 'runAllTicks', value: function runAllTicks()
{
this._checkFakeTimers();
// Only run a generous number of ticks and then bail.
// This is just to help avoid recursive loops
var i = void 0;
for (i = 0; i < this._maxLoops; i++) {
var tick = this._ticks.shift();
if (tick === undefined) {
break;
}
if (!this._cancelledTicks.hasOwnProperty(tick.uuid)) {
// Callback may throw, so update the map prior calling.
this._cancelledTicks[tick.uuid] = true;
tick.callback();
}
}
if (i === this._maxLoops) {
throw new Error(
'Ran ' +
this._maxLoops +
' ticks, and there are still more! ' +
"Assuming we've hit an infinite recursion and bailing out...");
}
} }, { key: 'runAllImmediates', value: function runAllImmediates()
{
this._checkFakeTimers();
// Only run a generous number of immediates and then bail.
var i = void 0;
for (i = 0; i < this._maxLoops; i++) {
var immediate = this._immediates.shift();
if (immediate === undefined) {
break;
}
this._runImmediate(immediate);
}
if (i === this._maxLoops) {
throw new Error(
'Ran ' +
this._maxLoops +
' immediates, and there are still more! Assuming ' +
"we've hit an infinite recursion and bailing out...");
}
} }, { key: '_runImmediate', value: function _runImmediate(
immediate) {
if (!this._cancelledImmediates.hasOwnProperty(immediate.uuid)) {
// Callback may throw, so update the map prior calling.
this._cancelledImmediates[immediate.uuid] = true;
immediate.callback();
}
} }, { key: 'runAllTimers', value: function runAllTimers()
{
this._checkFakeTimers();
this.runAllTicks();
this.runAllImmediates();
// Only run a generous number of timers and then bail.
// This is just to help avoid recursive loops
var i = void 0;
for (i = 0; i < this._maxLoops; i++) {
var nextTimerHandle = this._getNextTimerHandle();
// If there are no more timer handles, stop!
if (nextTimerHandle === null) {
break;
}
this._runTimerHandle(nextTimerHandle);
// Some of the immediate calls could be enqueued
// during the previous handling of the timers, we should
// run them as well.
if (this._immediates.length) {
this.runAllImmediates();
}
}
if (i === this._maxLoops) {
throw new Error(
'Ran ' +
this._maxLoops +
' timers, and there are still more! ' +
"Assuming we've hit an infinite recursion and bailing out...");
}
} }, { key: 'runOnlyPendingTimers', value: function runOnlyPendingTimers()
{
this._checkFakeTimers();
this._immediates.forEach(this._runImmediate, this);
var timers = this._timers;
(0, _keys2.default)(timers).
sort(function (left, right) {return timers[left].expiry - timers[right].expiry;}).
forEach(this._runTimerHandle, this);
} }, { key: 'runTimersToTime', value: function runTimersToTime(
msToRun) {
this._checkFakeTimers();
// Only run a generous number of timers and then bail.
// This is jsut to help avoid recursive loops
var i = void 0;
for (i = 0; i < this._maxLoops; i++) {
var timerHandle = this._getNextTimerHandle();
// If there are no more timer handles, stop!
if (timerHandle === null) {
break;
}
var nextTimerExpiry = this._timers[timerHandle].expiry;
if (this._now + msToRun < nextTimerExpiry) {
// There are no timers between now and the target we're running to, so
// adjust our time cursor and quit
this._now += msToRun;
break;
} else {
msToRun -= nextTimerExpiry - this._now;
this._now = nextTimerExpiry;
this._runTimerHandle(timerHandle);
}
}
if (i === this._maxLoops) {
throw new Error(
'Ran ' +
this._maxLoops +
' timers, and there are still more! ' +
"Assuming we've hit an infinite recursion and bailing out...");
}
} }, { key: 'runWithRealTimers', value: function runWithRealTimers(
cb) {
var prevClearImmediate = this._global.clearImmediate;
var prevClearInterval = this._global.clearInterval;
var prevClearTimeout = this._global.clearTimeout;
var prevNextTick = this._global.process.nextTick;
var prevSetImmediate = this._global.setImmediate;
var prevSetInterval = this._global.setInterval;
var prevSetTimeout = this._global.setTimeout;
this.useRealTimers();
var cbErr = null;
var errThrown = false;
try {
cb();
} catch (e) {
errThrown = true;
cbErr = e;
}
this._global.clearImmediate = prevClearImmediate;
this._global.clearInterval = prevClearInterval;
this._global.clearTimeout = prevClearTimeout;
this._global.process.nextTick = prevNextTick;
this._global.setImmediate = prevSetImmediate;
this._global.setInterval = prevSetInterval;
this._global.setTimeout = prevSetTimeout;
if (errThrown) {
throw cbErr;
}
} }, { key: 'useRealTimers', value: function useRealTimers()
{
var global = this._global;
setGlobal(global, 'clearImmediate', this._timerAPIs.clearImmediate);
setGlobal(global, 'clearInterval', this._timerAPIs.clearInterval);
setGlobal(global, 'clearTimeout', this._timerAPIs.clearTimeout);
setGlobal(global, 'setImmediate', this._timerAPIs.setImmediate);
setGlobal(global, 'setInterval', this._timerAPIs.setInterval);
setGlobal(global, 'setTimeout', this._timerAPIs.setTimeout);
global.process.nextTick = this._timerAPIs.nextTick;
} }, { key: 'useFakeTimers', value: function useFakeTimers()
{
this._createMocks();
var global = this._global;
setGlobal(global, 'clearImmediate', this._fakeTimerAPIs.clearImmediate);
setGlobal(global, 'clearInterval', this._fakeTimerAPIs.clearInterval);
setGlobal(global, 'clearTimeout', this._fakeTimerAPIs.clearTimeout);
setGlobal(global, 'setImmediate', this._fakeTimerAPIs.setImmediate);
setGlobal(global, 'setInterval', this._fakeTimerAPIs.setInterval);
setGlobal(global, 'setTimeout', this._fakeTimerAPIs.setTimeout);
global.process.nextTick = this._fakeTimerAPIs.nextTick;
} }, { key: '_checkFakeTimers', value: function _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, {
noStackTrace: false }));
}
} }, { key: '_createMocks', value: function _createMocks()
{var _this3 = this;
var fn = function fn(impl) {return _this3._moduleMocker.fn().mockImplementation(impl);};
this._fakeTimerAPIs = {
clearImmediate: fn(this._fakeClearImmediate.bind(this)),
clearInterval: fn(this._fakeClearTimer.bind(this)),
clearTimeout: fn(this._fakeClearTimer.bind(this)),
nextTick: fn(this._fakeNextTick.bind(this)),
setImmediate: fn(this._fakeSetImmediate.bind(this)),
setInterval: fn(this._fakeSetInterval.bind(this)),
setTimeout: fn(this._fakeSetTimeout.bind(this)) };
} }, { key: '_fakeClearTimer', value: function _fakeClearTimer(
uuid) {
if (this._timers.hasOwnProperty(uuid)) {
delete this._timers[uuid];
}
} }, { key: '_fakeClearImmediate', value: function _fakeClearImmediate(
uuid) {
this._cancelledImmediates[uuid] = true;
} }, { key: '_fakeNextTick', value: function _fakeNextTick(
callback) {var _this4 = this;
if (this._disposed) {
return;
}
var args = [];
for (var ii = 1, ll = arguments.length; ii < ll; ii++) {
args.push(arguments[ii]);
}
var uuid = String(this._uuidCounter++);
this._ticks.push({
callback: function (_callback) {function callback() {return _callback.apply(this, arguments);}callback.toString = function () {return _callback.toString();};return callback;}(function () {return callback.apply(null, args);}),
uuid: uuid });
var cancelledTicks = this._cancelledTicks;
this._timerAPIs.nextTick(function () {
if (_this4._blocked) {
return;
}
if (!cancelledTicks.hasOwnProperty(uuid)) {
// Callback may throw, so update the map prior calling.
cancelledTicks[uuid] = true;
callback.apply(null, args);
}
});
} }, { key: '_fakeSetImmediate', value: function _fakeSetImmediate(
callback) {
if (this._disposed) {
return null;
}
var args = [];
for (var ii = 1, ll = arguments.length; ii < ll; ii++) {
args.push(arguments[ii]);
}
var uuid = this._uuidCounter++;
this._immediates.push({
callback: function (_callback2) {function callback() {return _callback2.apply(this, arguments);}callback.toString = function () {return _callback2.toString();};return callback;}(function () {return callback.apply(null, args);}),
uuid: String(uuid) });
var cancelledImmediates = this._cancelledImmediates;
this._timerAPIs.setImmediate(function () {
if (!cancelledImmediates.hasOwnProperty(uuid)) {
// Callback may throw, so update the map prior calling.
cancelledImmediates[String(uuid)] = true;
callback.apply(null, args);
}
});
return uuid;
} }, { key: '_fakeSetInterval', value: function _fakeSetInterval(
callback, intervalDelay) {
if (this._disposed) {
return null;
}
if (intervalDelay == null) {
intervalDelay = 0;
}
var args = [];
for (var ii = 2, ll = arguments.length; ii < ll; ii++) {
args.push(arguments[ii]);
}
var uuid = this._uuidCounter++;
this._timers[String(uuid)] = {
callback: function (_callback3) {function callback() {return _callback3.apply(this, arguments);}callback.toString = function () {return _callback3.toString();};return callback;}(function () {return callback.apply(null, args);}),
expiry: this._now + intervalDelay,
interval: intervalDelay,
type: 'interval' };
return uuid;
} }, { key: '_fakeSetTimeout', value: function _fakeSetTimeout(
callback, delay) {
if (this._disposed) {
return null;
}
if (delay == null) {
delay = 0;
}
var args = [];
for (var ii = 2, ll = arguments.length; ii < ll; ii++) {
args.push(arguments[ii]);
}
var uuid = this._uuidCounter++;
this._timers[String(uuid)] = {
callback: function (_callback4) {function callback() {return _callback4.apply(this, arguments);}callback.toString = function () {return _callback4.toString();};return callback;}(function () {return callback.apply(null, args);}),
expiry: this._now + delay,
interval: null,
type: 'timeout' };
return uuid;
} }, { key: '_getNextTimerHandle', value: function _getNextTimerHandle()
{
var nextTimerHandle = null;
var uuid = void 0;
var soonestTime = MS_IN_A_YEAR;
var timer = void 0;
for (uuid in this._timers) {
timer = this._timers[uuid];
if (timer.expiry < soonestTime) {
soonestTime = timer.expiry;
nextTimerHandle = uuid;
}
}
return nextTimerHandle;
} }, { key: '_runTimerHandle', value: function _runTimerHandle(
timerHandle) {
var timer = this._timers[timerHandle];
if (!timer) {
return;
}
switch (timer.type) {
case 'timeout':
var _callback5 = timer.callback;
delete this._timers[timerHandle];
_callback5();
break;
case 'interval':
timer.expiry = this._now + timer.interval;
timer.callback();
break;
default:
throw new Error('Unexpected timer type: ' + timer.type);}
} }]);return FakeTimers;}();
module.exports = FakeTimers;

View File

@@ -0,0 +1,25 @@
'use strict';var _getPrototypeOf = require('babel-runtime/core-js/object/get-prototype-of');var _getPrototypeOf2 = _interopRequireDefault(_getPrototypeOf);var _classCallCheck2 = require('babel-runtime/helpers/classCallCheck');var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);var _createClass2 = require('babel-runtime/helpers/createClass');var _createClass3 = _interopRequireDefault(_createClass2);var _possibleConstructorReturn2 = require('babel-runtime/helpers/possibleConstructorReturn');var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);var _inherits2 = require('babel-runtime/helpers/inherits');var _inherits3 = _interopRequireDefault(_inherits2);function _interopRequireDefault(obj) {return obj && obj.__esModule ? obj : { default: obj };} /**
* 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.
*
*
*/
var Console = require('./Console');var
NullConsole = function (_Console) {(0, _inherits3.default)(NullConsole, _Console);function NullConsole() {(0, _classCallCheck3.default)(this, NullConsole);return (0, _possibleConstructorReturn3.default)(this, (NullConsole.__proto__ || (0, _getPrototypeOf2.default)(NullConsole)).apply(this, arguments));}(0, _createClass3.default)(NullConsole, [{ key: 'assert', value: function assert()
{} }, { key: 'dir', value: function dir()
{} }, { key: 'error', value: function error()
{} }, { key: 'info', value: function info()
{} }, { key: 'log', value: function log()
{} }, { key: 'time', value: function time()
{} }, { key: 'timeEnd', value: function timeEnd()
{} }, { key: 'trace', value: function trace()
{} }, { key: 'warn', value: function warn()
{} }]);return NullConsole;}(Console);
module.exports = NullConsole;

View File

@@ -0,0 +1,16 @@
'use strict'; /**
* 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.
*
*
*/
/* global stream$Writable */
module.exports = function (stream) {
if (process.stdout.isTTY) {
stream.write('\x1b[999D\x1b[K');
}
};

View File

@@ -0,0 +1,89 @@
'use strict';var _create = require('babel-runtime/core-js/object/create');var _create2 = _interopRequireDefault(_create);var _assign = require('babel-runtime/core-js/object/assign');var _assign2 = _interopRequireDefault(_assign);function _interopRequireDefault(obj) {return obj && obj.__esModule ? obj : { default: obj };}
var formatResult = function formatResult(
testResult,
codeCoverageFormatter,
reporter)
{
var now = Date.now();
var output = {
assertionResults: [],
coverage: {},
endTime: now,
message: '',
name: testResult.testFilePath,
startTime: now,
status: 'failed',
summary: '' };
if (testResult.testExecError) {
output.message = testResult.testExecError.message;
output.coverage = {};
} else {
var allTestsPassed = testResult.numFailingTests === 0;
output.status = allTestsPassed ? 'passed' : 'failed';
output.startTime = testResult.perfStats.start;
output.endTime = testResult.perfStats.end;
output.coverage = codeCoverageFormatter(testResult.coverage, reporter);
}
output.assertionResults = testResult.testResults.map(formatTestAssertion);
if (testResult.failureMessage) {
output.message = testResult.failureMessage;
}
return output;
}; /**
* 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.
*
*
*/function formatTestAssertion(assertion) {var result = { failureMessages: null, status: assertion.status, title: assertion.title };
if (assertion.failureMessages) {
result.failureMessages = assertion.failureMessages;
}
return result;
}
function formatTestResults(
results,
codeCoverageFormatter,
reporter)
{
var formatter = codeCoverageFormatter || function (coverage) {return coverage;};
var testResults = results.testResults.map(function (testResult) {return (
formatResult(testResult, formatter, reporter));});
return (0, _assign2.default)((0, _create2.default)(null), results, {
testResults: testResults });
}
module.exports = formatTestResults;

View File

@@ -0,0 +1,41 @@
'use strict'; /**
* Copyright (c) 2014, 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.
*
*
*/
var mkdirp = require('mkdirp');
var Console = require('./Console');
var FakeTimers = require('./FakeTimers');
var NullConsole = require('./NullConsole');
var clearLine = require('./clearLine');
var formatTestResults = require('./formatTestResults');
var installCommonGlobals = require('./installCommonGlobals');
var setGlobal = require('./setGlobal');
var validateCLIOptions = require('./validateCLIOptions');
var createDirectory = function createDirectory(path) {
try {
mkdirp.sync(path, '777');
} catch (e) {
if (e.code !== 'EEXIST') {
throw e;
}
}
};
module.exports = {
Console: Console,
FakeTimers: FakeTimers,
NullConsole: NullConsole,
clearLine: clearLine,
createDirectory: createDirectory,
formatTestResults: formatTestResults,
installCommonGlobals: installCommonGlobals,
setGlobal: setGlobal,
validateCLIOptions: validateCLIOptions };

View File

@@ -0,0 +1,57 @@
'use strict';var _clearImmediate2 = require('babel-runtime/core-js/clear-immediate');var _clearImmediate3 = _interopRequireDefault(_clearImmediate2);var _setImmediate2 = require('babel-runtime/core-js/set-immediate');var _setImmediate3 = _interopRequireDefault(_setImmediate2);var _assign = require('babel-runtime/core-js/object/assign');var _assign2 = _interopRequireDefault(_assign);var _defineProperty2 = require('babel-runtime/helpers/defineProperty');var _defineProperty3 = _interopRequireDefault(_defineProperty2);var _toStringTag = require('babel-runtime/core-js/symbol/to-string-tag');var _toStringTag2 = _interopRequireDefault(_toStringTag);var _symbol = require('babel-runtime/core-js/symbol');var _symbol2 = _interopRequireDefault(_symbol);var _typeof2 = require('babel-runtime/helpers/typeof');var _typeof3 = _interopRequireDefault(_typeof2);function _interopRequireDefault(obj) {return obj && obj.__esModule ? obj : { default: obj };} /**
* 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.
*
*
*/
function deepCopy(obj) {
var newObj = {};
var value = void 0;
for (var key in obj) {
value = obj[key];
if ((typeof value === 'undefined' ? 'undefined' : (0, _typeof3.default)(value)) === 'object' && value !== null) {
value = deepCopy(value);
}
newObj[key] = value;
}
return newObj;
}
module.exports = function (global, globals) {
// Forward some APIs
global.Buffer = Buffer;
// `global.process` is mutated by FakeTimers. Make a copy of the
// object for the jsdom environment to prevent memory leaks.
// Overwrite toString to make it look like the real process object
var toStringOverwrite = void 0;
if (_symbol2.default && _toStringTag2.default) {
// $FlowFixMe
toStringOverwrite = (0, _defineProperty3.default)({}, _toStringTag2.default,
'process');
}
global.process = (0, _assign2.default)({}, process, toStringOverwrite);
global.process.setMaxListeners = process.setMaxListeners.bind(process);
global.process.getMaxListeners = process.getMaxListeners.bind(process);
global.process.emit = process.emit.bind(process);
global.process.addListener = process.addListener.bind(process);
global.process.on = process.on.bind(process);
global.process.once = process.once.bind(process);
global.process.removeListener = process.removeListener.bind(process);
global.process.removeAllListeners = process.removeAllListeners.bind(process);
global.process.listeners = process.listeners.bind(process);
global.process.listenerCount = process.listenerCount.bind(process);
global.setImmediate = _setImmediate3.default;
global.clearImmediate = _clearImmediate3.default;
(0, _assign2.default)(global, deepCopy(globals));
};

View File

@@ -0,0 +1,22 @@
'use strict';
module.exports = function (global, key, value) {return (
global[key] = value);}; /**
* 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.
*
*
*/

View File

@@ -0,0 +1,68 @@
'use strict';var _set = require('babel-runtime/core-js/set');var _set2 = _interopRequireDefault(_set);var _keys = require('babel-runtime/core-js/object/keys');var _keys2 = _interopRequireDefault(_keys);var _from = require('babel-runtime/core-js/array/from');var _from2 = _interopRequireDefault(_from);function _interopRequireDefault(obj) {return obj && obj.__esModule ? obj : { default: obj };}
var chalk = require('chalk'); /**
* Copyright (c) 2014, 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.
*
*
*/var _require = require('jest-validate'),ValidationError = _require.ValidationError,format = _require.format,createDidYouMeanMessage = _require.createDidYouMeanMessage;var BULLET = chalk.bold('\u25CF');
var createCLIValidationError = function createCLIValidationError(
unrecognizedOptions,
allowedOptions)
{
var title = BULLET + ' Unrecognized CLI Parameter';
var message = void 0;
var comment =
' ' + chalk.bold('CLI Options Documentation') + ':\n' + ' http://facebook.github.io/jest/docs/cli.html\n';
if (unrecognizedOptions.length === 1) {
var unrecognized = unrecognizedOptions[0];
var didYouMeanMessage = createDidYouMeanMessage(
unrecognized,
(0, _from2.default)(allowedOptions));
message =
' Unrecognized option ' + chalk.bold(format(unrecognized)) + '.' + (
didYouMeanMessage ? ' ' + didYouMeanMessage : '');
} else {
title += 's';
message =
' Following options were not recognized:\n' + (' ' +
chalk.bold(format(unrecognizedOptions)));
}
return new ValidationError(title, message, comment);
};
var validateCLIOptions = function validateCLIOptions(argv, options) {
var yargsSpecialOptions = ['$0', '_', 'help', 'h'];
var allowedOptions = (0, _keys2.default)(options).reduce(
function (acc, option) {return acc.add(option).add(options[option].alias || option);},
new _set2.default(yargsSpecialOptions));
var unrecognizedOptions = (0, _keys2.default)(argv).filter(
function (arg) {return !allowedOptions.has(arg);});
if (unrecognizedOptions.length) {
throw createCLIValidationError(unrecognizedOptions, allowedOptions);
}
return true;
};
module.exports = validateCLIOptions;

View File

@@ -0,0 +1,60 @@
'use strict';var _require =
require('util');const format = _require.format; /**
* 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.
*
*
*/ /* global stream$Writable */var _require2 = require('console');const Console = _require2.Console;const clearLine = require('./clearLine');class CustomConsole extends Console {
constructor(
stdout,
stderr,
formatBuffer)
{
super(stdout, stderr);
this._formatBuffer = formatBuffer || ((type, message) => message);
}
_log(type, message) {
clearLine(this._stdout);
super.log(this._formatBuffer(type, message));
}
log() {
this._log('log', format.apply(null, arguments));
}
info() {
this._log('info', format.apply(null, arguments));
}
warn() {
this._log('warn', format.apply(null, arguments));
}
error() {
this._log('error', format.apply(null, arguments));
}
getBuffer() {
return null;
}}
module.exports = CustomConsole;

View File

@@ -0,0 +1,515 @@
'use strict';var _require =
require('jest-message-util');const formatStackTrace = _require.formatStackTrace; /**
* 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.
*
*
*/const setGlobal = require('./setGlobal');
const MS_IN_A_YEAR = 31536000000;
class FakeTimers {
constructor(
global,
moduleMocker,
config,
maxLoops)
{
this._global = global;
this._config = config;
this._maxLoops = maxLoops || 100000;
this._uuidCounter = 1;
this._moduleMocker = moduleMocker;
// Store original timer APIs for future reference
this._timerAPIs = {
clearImmediate: global.clearImmediate,
clearInterval: global.clearInterval,
clearTimeout: global.clearTimeout,
nextTick: global.process && global.process.nextTick,
setImmediate: global.setImmediate,
setInterval: global.setInterval,
setTimeout: global.setTimeout };
this.reset();
this._createMocks();
// These globally-accessible function are now deprecated!
// They will go away very soon, so do not use them!
// Instead, use the versions available on the `jest` object
global.mockRunTicksRepeatedly = this.runAllTicks.bind(this);
global.mockRunTimersOnce = this.runOnlyPendingTimers.bind(this);
global.mockRunTimersToTime = this.runTimersToTime.bind(this);
global.mockRunTimersRepeatedly = this.runAllTimers.bind(this);
global.mockClearTimers = this.clearAllTimers.bind(this);
global.mockGetTimersCount = () => Object.keys(this._timers).length;
}
clearAllTimers() {
this._immediates.forEach(immediate =>
this._fakeClearImmediate(immediate.uuid));
for (const uuid in this._timers) {
delete this._timers[uuid];
}
}
dispose() {
this._disposed = true;
this.clearAllTimers();
}
reset() {
this._cancelledTicks = {};
this._cancelledImmediates = {};
this._now = 0;
this._ticks = [];
this._immediates = [];
this._timers = {};
}
runAllTicks() {
this._checkFakeTimers();
// Only run a generous number of ticks and then bail.
// This is just to help avoid recursive loops
let i;
for (i = 0; i < this._maxLoops; i++) {
const tick = this._ticks.shift();
if (tick === undefined) {
break;
}
if (!this._cancelledTicks.hasOwnProperty(tick.uuid)) {
// Callback may throw, so update the map prior calling.
this._cancelledTicks[tick.uuid] = true;
tick.callback();
}
}
if (i === this._maxLoops) {
throw new Error(
'Ran ' +
this._maxLoops +
' ticks, and there are still more! ' +
"Assuming we've hit an infinite recursion and bailing out...");
}
}
runAllImmediates() {
this._checkFakeTimers();
// Only run a generous number of immediates and then bail.
let i;
for (i = 0; i < this._maxLoops; i++) {
const immediate = this._immediates.shift();
if (immediate === undefined) {
break;
}
this._runImmediate(immediate);
}
if (i === this._maxLoops) {
throw new Error(
'Ran ' +
this._maxLoops +
' immediates, and there are still more! Assuming ' +
"we've hit an infinite recursion and bailing out...");
}
}
_runImmediate(immediate) {
if (!this._cancelledImmediates.hasOwnProperty(immediate.uuid)) {
// Callback may throw, so update the map prior calling.
this._cancelledImmediates[immediate.uuid] = true;
immediate.callback();
}
}
runAllTimers() {
this._checkFakeTimers();
this.runAllTicks();
this.runAllImmediates();
// Only run a generous number of timers and then bail.
// This is just to help avoid recursive loops
let i;
for (i = 0; i < this._maxLoops; i++) {
const nextTimerHandle = this._getNextTimerHandle();
// If there are no more timer handles, stop!
if (nextTimerHandle === null) {
break;
}
this._runTimerHandle(nextTimerHandle);
// Some of the immediate calls could be enqueued
// during the previous handling of the timers, we should
// run them as well.
if (this._immediates.length) {
this.runAllImmediates();
}
}
if (i === this._maxLoops) {
throw new Error(
'Ran ' +
this._maxLoops +
' timers, and there are still more! ' +
"Assuming we've hit an infinite recursion and bailing out...");
}
}
runOnlyPendingTimers() {
this._checkFakeTimers();
this._immediates.forEach(this._runImmediate, this);
const timers = this._timers;
Object.keys(timers).
sort((left, right) => timers[left].expiry - timers[right].expiry).
forEach(this._runTimerHandle, this);
}
runTimersToTime(msToRun) {
this._checkFakeTimers();
// Only run a generous number of timers and then bail.
// This is jsut to help avoid recursive loops
let i;
for (i = 0; i < this._maxLoops; i++) {
const timerHandle = this._getNextTimerHandle();
// If there are no more timer handles, stop!
if (timerHandle === null) {
break;
}
const nextTimerExpiry = this._timers[timerHandle].expiry;
if (this._now + msToRun < nextTimerExpiry) {
// There are no timers between now and the target we're running to, so
// adjust our time cursor and quit
this._now += msToRun;
break;
} else {
msToRun -= nextTimerExpiry - this._now;
this._now = nextTimerExpiry;
this._runTimerHandle(timerHandle);
}
}
if (i === this._maxLoops) {
throw new Error(
'Ran ' +
this._maxLoops +
' timers, and there are still more! ' +
"Assuming we've hit an infinite recursion and bailing out...");
}
}
runWithRealTimers(cb) {
const prevClearImmediate = this._global.clearImmediate;
const prevClearInterval = this._global.clearInterval;
const prevClearTimeout = this._global.clearTimeout;
const prevNextTick = this._global.process.nextTick;
const prevSetImmediate = this._global.setImmediate;
const prevSetInterval = this._global.setInterval;
const prevSetTimeout = this._global.setTimeout;
this.useRealTimers();
let cbErr = null;
let errThrown = false;
try {
cb();
} catch (e) {
errThrown = true;
cbErr = e;
}
this._global.clearImmediate = prevClearImmediate;
this._global.clearInterval = prevClearInterval;
this._global.clearTimeout = prevClearTimeout;
this._global.process.nextTick = prevNextTick;
this._global.setImmediate = prevSetImmediate;
this._global.setInterval = prevSetInterval;
this._global.setTimeout = prevSetTimeout;
if (errThrown) {
throw cbErr;
}
}
useRealTimers() {
const global = this._global;
setGlobal(global, 'clearImmediate', this._timerAPIs.clearImmediate);
setGlobal(global, 'clearInterval', this._timerAPIs.clearInterval);
setGlobal(global, 'clearTimeout', this._timerAPIs.clearTimeout);
setGlobal(global, 'setImmediate', this._timerAPIs.setImmediate);
setGlobal(global, 'setInterval', this._timerAPIs.setInterval);
setGlobal(global, 'setTimeout', this._timerAPIs.setTimeout);
global.process.nextTick = this._timerAPIs.nextTick;
}
useFakeTimers() {
this._createMocks();
const global = this._global;
setGlobal(global, 'clearImmediate', this._fakeTimerAPIs.clearImmediate);
setGlobal(global, 'clearInterval', this._fakeTimerAPIs.clearInterval);
setGlobal(global, 'clearTimeout', this._fakeTimerAPIs.clearTimeout);
setGlobal(global, 'setImmediate', this._fakeTimerAPIs.setImmediate);
setGlobal(global, 'setInterval', this._fakeTimerAPIs.setInterval);
setGlobal(global, 'setTimeout', this._fakeTimerAPIs.setTimeout);
global.process.nextTick = this._fakeTimerAPIs.nextTick;
}
_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, {
noStackTrace: false }));
}
}
_createMocks() {
const fn = impl => this._moduleMocker.fn().mockImplementation(impl);
this._fakeTimerAPIs = {
clearImmediate: fn(this._fakeClearImmediate.bind(this)),
clearInterval: fn(this._fakeClearTimer.bind(this)),
clearTimeout: fn(this._fakeClearTimer.bind(this)),
nextTick: fn(this._fakeNextTick.bind(this)),
setImmediate: fn(this._fakeSetImmediate.bind(this)),
setInterval: fn(this._fakeSetInterval.bind(this)),
setTimeout: fn(this._fakeSetTimeout.bind(this)) };
}
_fakeClearTimer(uuid) {
if (this._timers.hasOwnProperty(uuid)) {
delete this._timers[uuid];
}
}
_fakeClearImmediate(uuid) {
this._cancelledImmediates[uuid] = true;
}
_fakeNextTick(callback) {
if (this._disposed) {
return;
}
const args = [];
for (let ii = 1, ll = arguments.length; ii < ll; ii++) {
args.push(arguments[ii]);
}
const uuid = String(this._uuidCounter++);
this._ticks.push({
callback: () => callback.apply(null, args),
uuid });
const cancelledTicks = this._cancelledTicks;
this._timerAPIs.nextTick(() => {
if (this._blocked) {
return;
}
if (!cancelledTicks.hasOwnProperty(uuid)) {
// Callback may throw, so update the map prior calling.
cancelledTicks[uuid] = true;
callback.apply(null, args);
}
});
}
_fakeSetImmediate(callback) {
if (this._disposed) {
return null;
}
const args = [];
for (let ii = 1, ll = arguments.length; ii < ll; ii++) {
args.push(arguments[ii]);
}
const uuid = this._uuidCounter++;
this._immediates.push({
callback: () => callback.apply(null, args),
uuid: String(uuid) });
const cancelledImmediates = this._cancelledImmediates;
this._timerAPIs.setImmediate(() => {
if (!cancelledImmediates.hasOwnProperty(uuid)) {
// Callback may throw, so update the map prior calling.
cancelledImmediates[String(uuid)] = true;
callback.apply(null, args);
}
});
return uuid;
}
_fakeSetInterval(callback, intervalDelay) {
if (this._disposed) {
return null;
}
if (intervalDelay == null) {
intervalDelay = 0;
}
const args = [];
for (let ii = 2, ll = arguments.length; ii < ll; ii++) {
args.push(arguments[ii]);
}
const uuid = this._uuidCounter++;
this._timers[String(uuid)] = {
callback: () => callback.apply(null, args),
expiry: this._now + intervalDelay,
interval: intervalDelay,
type: 'interval' };
return uuid;
}
_fakeSetTimeout(callback, delay) {
if (this._disposed) {
return null;
}
if (delay == null) {
delay = 0;
}
const args = [];
for (let ii = 2, ll = arguments.length; ii < ll; ii++) {
args.push(arguments[ii]);
}
const uuid = this._uuidCounter++;
this._timers[String(uuid)] = {
callback: () => callback.apply(null, args),
expiry: this._now + delay,
interval: null,
type: 'timeout' };
return uuid;
}
_getNextTimerHandle() {
let nextTimerHandle = null;
let uuid;
let soonestTime = MS_IN_A_YEAR;
let timer;
for (uuid in this._timers) {
timer = this._timers[uuid];
if (timer.expiry < soonestTime) {
soonestTime = timer.expiry;
nextTimerHandle = uuid;
}
}
return nextTimerHandle;
}
_runTimerHandle(timerHandle) {
const timer = this._timers[timerHandle];
if (!timer) {
return;
}
switch (timer.type) {
case 'timeout':
const callback = timer.callback;
delete this._timers[timerHandle];
callback();
break;
case 'interval':
timer.expiry = this._now + timer.interval;
timer.callback();
break;
default:
throw new Error('Unexpected timer type: ' + timer.type);}
}}
module.exports = FakeTimers;

View File

@@ -0,0 +1,25 @@
'use strict'; /**
* 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.
*
*
*/
const Console = require('./Console');
class NullConsole extends Console {
assert() {}
dir() {}
error() {}
info() {}
log() {}
time() {}
timeEnd() {}
trace() {}
warn() {}}
module.exports = NullConsole;

View File

@@ -0,0 +1,16 @@
'use strict'; /**
* 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.
*
*
*/
/* global stream$Writable */
module.exports = stream => {
if (process.stdout.isTTY) {
stream.write('\x1b[999D\x1b[K');
}
};

View File

@@ -0,0 +1,89 @@
'use strict';
const formatResult = (
testResult,
codeCoverageFormatter,
reporter) =>
{
const now = Date.now();
const output = {
assertionResults: [],
coverage: {},
endTime: now,
message: '',
name: testResult.testFilePath,
startTime: now,
status: 'failed',
summary: '' };
if (testResult.testExecError) {
output.message = testResult.testExecError.message;
output.coverage = {};
} else {
const allTestsPassed = testResult.numFailingTests === 0;
output.status = allTestsPassed ? 'passed' : 'failed';
output.startTime = testResult.perfStats.start;
output.endTime = testResult.perfStats.end;
output.coverage = codeCoverageFormatter(testResult.coverage, reporter);
}
output.assertionResults = testResult.testResults.map(formatTestAssertion);
if (testResult.failureMessage) {
output.message = testResult.failureMessage;
}
return output;
}; /**
* 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.
*
*
*/function formatTestAssertion(assertion) {const result = { failureMessages: null, status: assertion.status, title: assertion.title };
if (assertion.failureMessages) {
result.failureMessages = assertion.failureMessages;
}
return result;
}
function formatTestResults(
results,
codeCoverageFormatter,
reporter)
{
const formatter = codeCoverageFormatter || (coverage => coverage);
const testResults = results.testResults.map(testResult =>
formatResult(testResult, formatter, reporter));
return Object.assign(Object.create(null), results, {
testResults });
}
module.exports = formatTestResults;

View File

@@ -0,0 +1,41 @@
'use strict'; /**
* Copyright (c) 2014, 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.
*
*
*/
const mkdirp = require('mkdirp');
const Console = require('./Console');
const FakeTimers = require('./FakeTimers');
const NullConsole = require('./NullConsole');
const clearLine = require('./clearLine');
const formatTestResults = require('./formatTestResults');
const installCommonGlobals = require('./installCommonGlobals');
const setGlobal = require('./setGlobal');
const validateCLIOptions = require('./validateCLIOptions');
const createDirectory = path => {
try {
mkdirp.sync(path, '777');
} catch (e) {
if (e.code !== 'EEXIST') {
throw e;
}
}
};
module.exports = {
Console,
FakeTimers,
NullConsole,
clearLine,
createDirectory,
formatTestResults,
installCommonGlobals,
setGlobal,
validateCLIOptions };

View File

@@ -0,0 +1,57 @@
'use strict'; /**
* 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.
*
*
*/
function deepCopy(obj) {
const newObj = {};
let value;
for (const key in obj) {
value = obj[key];
if (typeof value === 'object' && value !== null) {
value = deepCopy(value);
}
newObj[key] = value;
}
return newObj;
}
module.exports = (global, globals) => {
// Forward some APIs
global.Buffer = Buffer;
// `global.process` is mutated by FakeTimers. Make a copy of the
// object for the jsdom environment to prevent memory leaks.
// 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);
global.process.getMaxListeners = process.getMaxListeners.bind(process);
global.process.emit = process.emit.bind(process);
global.process.addListener = process.addListener.bind(process);
global.process.on = process.on.bind(process);
global.process.once = process.once.bind(process);
global.process.removeListener = process.removeListener.bind(process);
global.process.removeAllListeners = process.removeAllListeners.bind(process);
global.process.listeners = process.listeners.bind(process);
global.process.listenerCount = process.listenerCount.bind(process);
global.setImmediate = setImmediate;
global.clearImmediate = clearImmediate;
Object.assign(global, deepCopy(globals));
};

View File

@@ -0,0 +1,22 @@
'use strict';
module.exports = (global, key, value) =>
global[key] = value; /**
* 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.
*
*
*/

View File

@@ -0,0 +1,68 @@
'use strict';
const chalk = require('chalk'); /**
* Copyright (c) 2014, 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.
*
*
*/var _require = require('jest-validate');const ValidationError = _require.ValidationError,format = _require.format,createDidYouMeanMessage = _require.createDidYouMeanMessage;const BULLET = chalk.bold('\u25cf');
const createCLIValidationError = (
unrecognizedOptions,
allowedOptions) =>
{
let title = `${BULLET} Unrecognized CLI Parameter`;
let message;
const comment =
` ${chalk.bold('CLI Options Documentation')}:\n` +
` http://facebook.github.io/jest/docs/cli.html\n`;
if (unrecognizedOptions.length === 1) {
const unrecognized = unrecognizedOptions[0];
const didYouMeanMessage = createDidYouMeanMessage(
unrecognized,
Array.from(allowedOptions));
message =
` Unrecognized option ${chalk.bold(format(unrecognized))}.` + (
didYouMeanMessage ? ` ${didYouMeanMessage}` : '');
} else {
title += 's';
message =
` Following options were not recognized:\n` +
` ${chalk.bold(format(unrecognizedOptions))}`;
}
return new ValidationError(title, message, comment);
};
const validateCLIOptions = (argv, options) => {
const yargsSpecialOptions = ['$0', '_', 'help', 'h'];
const allowedOptions = Object.keys(options).reduce(
(acc, option) => acc.add(option).add(options[option].alias || option),
new Set(yargsSpecialOptions));
const unrecognizedOptions = Object.keys(argv).filter(
arg => !allowedOptions.has(arg));
if (unrecognizedOptions.length) {
throw createCLIValidationError(unrecognizedOptions, allowedOptions);
}
return true;
};
module.exports = validateCLIOptions;

View File

@@ -0,0 +1,56 @@
{
"_args": [
[
"jest-util@20.0.3",
"C:\\Users\\deranjer\\go\\src\\github.com\\deranjer\\goTorrent\\torrent-project"
]
],
"_from": "jest-util@20.0.3",
"_id": "jest-util@20.0.3",
"_inBundle": false,
"_integrity": "sha1-DAf32A2C9OWmfG+LnD/n9lz9Mq0=",
"_location": "/react-scripts/jest-util",
"_phantomChildren": {},
"_requested": {
"type": "version",
"registry": true,
"raw": "jest-util@20.0.3",
"name": "jest-util",
"escapedName": "jest-util",
"rawSpec": "20.0.3",
"saveSpec": null,
"fetchSpec": "20.0.3"
},
"_requiredBy": [
"/react-scripts/jest-environment-jsdom",
"/react-scripts/jest-environment-node",
"/react-scripts/jest-runtime",
"/react-scripts/jest-snapshot",
"/react-scripts/jest/jest-cli"
],
"_resolved": "https://registry.npmjs.org/jest-util/-/jest-util-20.0.3.tgz",
"_spec": "20.0.3",
"_where": "C:\\Users\\deranjer\\go\\src\\github.com\\deranjer\\goTorrent\\torrent-project",
"browser": "build-es5/index.js",
"bugs": {
"url": "https://github.com/facebook/jest/issues"
},
"dependencies": {
"chalk": "^1.1.3",
"graceful-fs": "^4.1.11",
"jest-message-util": "^20.0.3",
"jest-mock": "^20.0.3",
"jest-validate": "^20.0.3",
"leven": "^2.1.0",
"mkdirp": "^0.5.1"
},
"homepage": "https://github.com/facebook/jest#readme",
"license": "BSD-3-Clause",
"main": "build/index.js",
"name": "jest-util",
"repository": {
"type": "git",
"url": "git+https://github.com/facebook/jest.git"
},
"version": "20.0.3"
}