initial commit taken from gitlab.lrz.de

This commit is contained in:
privatereese
2018-08-24 18:09:42 +02:00
parent ae54ed4c48
commit fc05486403
28494 changed files with 2159823 additions and 0 deletions

169
node_modules/jest-util/build/Console.js generated vendored Normal file
View File

@@ -0,0 +1,169 @@
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _assert;
function _load_assert() {
return _assert = _interopRequireDefault(require('assert'));
}
var _util;
function _load_util() {
return _util = require('util');
}
var _console;
function _load_console() {
return _console = require('console');
}
var _chalk;
function _load_chalk() {
return _chalk = _interopRequireDefault(require('chalk'));
}
var _clear_line;
function _load_clear_line() {
return _clear_line = _interopRequireDefault(require('./clear_line'));
}
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 MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*
*/
/* global stream$Writable */
class CustomConsole extends (_console || _load_console()).Console {
constructor(stdout, stderr, formatBuffer) {
super(stdout, stderr);
this._formatBuffer = formatBuffer || ((type, message) => message);
this._counters = {};
this._timers = {};
this._groupDepth = 0;
}
_logToParentConsole(message) {
super.log(message);
}
_log(type, message) {
(0, (_clear_line || _load_clear_line()).default)(this._stdout);
this._logToParentConsole(this._formatBuffer(type, ' '.repeat(this._groupDepth) + message));
}
assert() {
try {
(_assert || _load_assert()).default.apply(undefined, arguments);
} catch (error) {
this._log('assert', error.toString());
}
}
count() {
let label = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'default';
if (!this._counters[label]) {
this._counters[label] = 0;
}
this._log('count', (0, (_util || _load_util()).format)(`${label}: ${++this._counters[label]}`));
}
countReset() {
let label = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'default';
this._counters[label] = 0;
}
debug() {
this._log('debug', (_util || _load_util()).format.apply(undefined, arguments));
}
dir() {
this._log('dir', (_util || _load_util()).format.apply(undefined, arguments));
}
dirxml() {
this._log('dirxml', (_util || _load_util()).format.apply(undefined, arguments));
}
error() {
this._log('error', (_util || _load_util()).format.apply(undefined, arguments));
}
group() {
this._groupDepth++;
if (arguments.length > 0) {
this._log('group', (_chalk || _load_chalk()).default.bold((_util || _load_util()).format.apply(undefined, arguments)));
}
}
groupCollapsed() {
this._groupDepth++;
if (arguments.length > 0) {
this._log('groupCollapsed', (_chalk || _load_chalk()).default.bold((_util || _load_util()).format.apply(undefined, arguments)));
}
}
groupEnd() {
if (this._groupDepth > 0) {
this._groupDepth--;
}
}
info() {
this._log('info', (_util || _load_util()).format.apply(undefined, arguments));
}
log() {
this._log('log', (_util || _load_util()).format.apply(undefined, arguments));
}
time() {
let label = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'default';
if (this._timers[label]) {
return;
}
this._timers[label] = new Date();
}
timeEnd() {
let label = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'default';
const startTime = this._timers[label];
if (startTime) {
const endTime = new Date();
const time = (endTime - startTime) / 1000;
this._log('time', (0, (_util || _load_util()).format)(`${label}: ${time}ms`));
delete this._timers[label];
}
}
warn() {
this._log('warn', (_util || _load_util()).format.apply(undefined, arguments));
}
getBuffer() {
return null;
}
}
exports.default = CustomConsole;

178
node_modules/jest-util/build/buffered_console.js generated vendored Normal file
View File

@@ -0,0 +1,178 @@
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _assert;
function _load_assert() {
return _assert = _interopRequireDefault(require('assert'));
}
var _console;
function _load_console() {
return _console = require('console');
}
var _util;
function _load_util() {
return _util = require('util');
}
var _chalk;
function _load_chalk() {
return _chalk = _interopRequireDefault(require('chalk'));
}
var _get_callsite;
function _load_get_callsite() {
return _get_callsite = _interopRequireDefault(require('./get_callsite'));
}
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
class BufferedConsole extends (_console || _load_console()).Console {
constructor(getSourceMaps) {
const buffer = [];
super({
write: message => BufferedConsole.write(buffer, 'log', message, null, getSourceMaps())
});
this._getSourceMaps = getSourceMaps;
this._buffer = buffer;
this._counters = {};
this._timers = {};
this._groupDepth = 0;
}
static write(buffer, type, message, level, sourceMaps) {
const callsite = (0, (_get_callsite || _load_get_callsite()).default)(level != null ? level : 2, sourceMaps);
const origin = callsite.getFileName() + ':' + callsite.getLineNumber();
buffer.push({
message,
origin,
type
});
return buffer;
}
_log(type, message) {
BufferedConsole.write(this._buffer, type, ' '.repeat(this._groupDepth) + message, 3, this._getSourceMaps());
}
assert() {
try {
(_assert || _load_assert()).default.apply(undefined, arguments);
} catch (error) {
this._log('assert', error.toString());
}
}
count() {
let label = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'default';
if (!this._counters[label]) {
this._counters[label] = 0;
}
this._log('count', (0, (_util || _load_util()).format)(`${label}: ${++this._counters[label]}`));
}
countReset() {
let label = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'default';
this._counters[label] = 0;
}
debug() {
this._log('debug', (_util || _load_util()).format.apply(undefined, arguments));
}
dir() {
this._log('dir', (_util || _load_util()).format.apply(undefined, arguments));
}
dirxml() {
this._log('dirxml', (_util || _load_util()).format.apply(undefined, arguments));
}
error() {
this._log('error', (_util || _load_util()).format.apply(undefined, arguments));
}
group() {
this._groupDepth++;
if (arguments.length > 0) {
this._log('group', (_chalk || _load_chalk()).default.bold((_util || _load_util()).format.apply(undefined, arguments)));
}
}
groupCollapsed() {
this._groupDepth++;
if (arguments.length > 0) {
this._log('groupCollapsed', (_chalk || _load_chalk()).default.bold((_util || _load_util()).format.apply(undefined, arguments)));
}
}
groupEnd() {
if (this._groupDepth > 0) {
this._groupDepth--;
}
}
info() {
this._log('info', (_util || _load_util()).format.apply(undefined, arguments));
}
log() {
this._log('log', (_util || _load_util()).format.apply(undefined, arguments));
}
time() {
let label = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'default';
if (this._timers[label]) {
return;
}
this._timers[label] = new Date();
}
timeEnd() {
let label = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'default';
const startTime = this._timers[label];
if (startTime) {
const endTime = new Date();
const time = (endTime - startTime) / 1000;
this._log('time', (0, (_util || _load_util()).format)(`${label}: ${time}ms`));
delete this._timers[label];
}
}
warn() {
this._log('warn', (_util || _load_util()).format.apply(undefined, arguments));
}
getBuffer() {
return this._buffer;
}
}
exports.default = BufferedConsole; /**
* 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.
*
*
*/

21
node_modules/jest-util/build/clear_line.js generated vendored Normal file
View File

@@ -0,0 +1,21 @@
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
/**
* 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.
*
*
*/
/* global stream$Writable */
exports.default = stream => {
if (process.stdout.isTTY) {
stream.write('\x1b[999D\x1b[K');
}
};

107
node_modules/jest-util/build/create_process_object.js generated vendored Normal file
View File

@@ -0,0 +1,107 @@
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = function () {
const process = require('process');
const newProcess = (0, (_deep_cyclic_copy || _load_deep_cyclic_copy()).default)(process, {
blacklist: BLACKLIST,
keepPrototype: true
});
newProcess[Symbol.toStringTag] = 'process';
// Sequentially execute all constructors over the object.
let proto = process;
while (proto = Object.getPrototypeOf(proto)) {
if (typeof proto.constructor === 'function') {
proto.constructor.call(newProcess);
}
}
newProcess.env = createProcessEnv();
return newProcess;
};
var _deep_cyclic_copy;
function _load_deep_cyclic_copy() {
return _deep_cyclic_copy = _interopRequireDefault(require('./deep_cyclic_copy'));
}
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
const BLACKLIST = new Set(['env', 'mainModule', '_events']);
// The "process.env" object has a bunch of particularities: first, it does not
// directly extend from Object; second, it converts any assigned value to a
// string; and third, it is case-insensitive in Windows. We use a proxy here to
// mimic it (see https://nodejs.org/api/process.html#process_process_env).
/**
* Copyright (c) 2017-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.
*
*
*/
function createProcessEnv() {
if (typeof Proxy === 'undefined') {
return (0, (_deep_cyclic_copy || _load_deep_cyclic_copy()).default)(process.env);
}
// $FlowFixMe: Apparently Flow does not understand that this is a prototype.
const proto = Object.getPrototypeOf(process.env);
const real = Object.create(proto);
const lookup = {};
const proxy = new Proxy(real, {
deleteProperty(target, key) {
for (const name in real) {
if (real.hasOwnProperty(name)) {
if (typeof key === 'string' && process.platform === 'win32') {
if (name.toLowerCase() === key.toLowerCase()) {
delete real[name];
delete lookup[name.toLowerCase()];
}
} else {
if (key === name) {
delete real[name];
delete lookup[name];
}
}
}
}
return true;
},
get(target, key) {
if (typeof key === 'string' && process.platform === 'win32') {
return lookup[key in proto ? key : key.toLowerCase()];
} else {
return real[key];
}
},
set(target, key, value) {
const strValue = '' + value;
if (typeof key === 'string') {
lookup[key.toLowerCase()] = strValue;
}
real[key] = strValue;
return true;
}
});
return Object.assign(proxy, process.env);
}

84
node_modules/jest-util/build/deep_cyclic_copy.js generated vendored Normal file
View File

@@ -0,0 +1,84 @@
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = deepCyclicCopy;
/**
* Copyright (c) 2017-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 EMPTY = new Set();
// Node 6 does not have gOPDs, so we define a simple polyfill for it.
if (!Object.getOwnPropertyDescriptors) {
// $FlowFixMe: polyfill
Object.getOwnPropertyDescriptors = obj => {
const list = {};
Object.getOwnPropertyNames(obj).concat(Object.getOwnPropertySymbols(obj))
// $FlowFixMe: assignment with a Symbol is OK.
.forEach(key => list[key] = Object.getOwnPropertyDescriptor(obj, key));
return list;
};
}
function deepCyclicCopy(value) {
let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : { blacklist: EMPTY, keepPrototype: false };
let cycles = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : new WeakMap();
if (typeof value !== 'object' || value === null) {
return value;
} else if (cycles.has(value)) {
return cycles.get(value);
} else if (Array.isArray(value)) {
return deepCyclicCopyArray(value, options, cycles);
} else {
return deepCyclicCopyObject(value, options, cycles);
}
}
function deepCyclicCopyObject(object, options, cycles) {
const newObject = options.keepPrototype ? Object.create(Object.getPrototypeOf(object)) : {};
// $FlowFixMe: Object.getOwnPropertyDescriptors is polyfilled above.
const descriptors = Object.getOwnPropertyDescriptors(object);
cycles.set(object, newObject);
Object.keys(descriptors).forEach(key => {
if (options.blacklist && options.blacklist.has(key)) {
delete descriptors[key];
return;
}
const descriptor = descriptors[key];
if (typeof descriptor.value !== 'undefined') {
descriptor.value = deepCyclicCopy(descriptor.value, { blacklist: EMPTY, keepPrototype: options.keepPrototype }, cycles);
}
descriptor.configurable = true;
});
return Object.defineProperties(newObject, descriptors);
}
function deepCyclicCopyArray(array, options, cycles) {
const newArray = options.keepPrototype ? // $FlowFixMe: getPrototypeOf an array is OK.
new (Object.getPrototypeOf(array).constructor)(array.length) : [];
const length = array.length;
cycles.set(array, newArray);
for (let i = 0; i < length; i++) {
newArray[i] = deepCyclicCopy(array[i], { blacklist: EMPTY, keepPrototype: options.keepPrototype }, cycles);
}
return newArray;
}

467
node_modules/jest-util/build/fake_timers.js generated vendored Normal file
View File

@@ -0,0 +1,467 @@
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _jestMessageUtil;
function _load_jestMessageUtil() {
return _jestMessageUtil = require('jest-message-util');
}
var _set_global;
function _load_set_global() {
return _set_global = _interopRequireDefault(require('./set_global'));
}
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* We don't know the type of arguments for a callback ahead of time which is why
* we are disabling the flowtype/no-weak-types rule here.
*/
/* eslint-disable flowtype/no-weak-types */
/* eslint-enable flowtype/no-weak-types */
const MS_IN_A_YEAR = 31536000000; /**
* 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.
*
*
*/
class FakeTimers {
constructor(_ref) {
let global = _ref.global,
moduleMocker = _ref.moduleMocker,
timerConfig = _ref.timerConfig,
config = _ref.config,
maxLoops = _ref.maxLoops;
this._global = global;
this._timerConfig = timerConfig;
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.mockAdvanceTimersByTime = this.advanceTimersByTime.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 (this._ticks.length) {
this.runAllTicks();
}
}
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() {
const timers = Object.assign({}, this._timers);
this._checkFakeTimers();
this._immediates.forEach(this._runImmediate, this);
Object.keys(timers).sort((left, right) => timers[left].expiry - timers[right].expiry).forEach(this._runTimerHandle, this);
}
advanceTimersByTime(msToRun) {
this._checkFakeTimers();
// 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 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;
(0, (_set_global || _load_set_global()).default)(global, 'clearImmediate', this._timerAPIs.clearImmediate);
(0, (_set_global || _load_set_global()).default)(global, 'clearInterval', this._timerAPIs.clearInterval);
(0, (_set_global || _load_set_global()).default)(global, 'clearTimeout', this._timerAPIs.clearTimeout);
(0, (_set_global || _load_set_global()).default)(global, 'setImmediate', this._timerAPIs.setImmediate);
(0, (_set_global || _load_set_global()).default)(global, 'setInterval', this._timerAPIs.setInterval);
(0, (_set_global || _load_set_global()).default)(global, 'setTimeout', this._timerAPIs.setTimeout);
global.process.nextTick = this._timerAPIs.nextTick;
}
useFakeTimers() {
this._createMocks();
const global = this._global;
(0, (_set_global || _load_set_global()).default)(global, 'clearImmediate', this._fakeTimerAPIs.clearImmediate);
(0, (_set_global || _load_set_global()).default)(global, 'clearInterval', this._fakeTimerAPIs.clearInterval);
(0, (_set_global || _load_set_global()).default)(global, 'clearTimeout', this._fakeTimerAPIs.clearTimeout);
(0, (_set_global || _load_set_global()).default)(global, 'setImmediate', this._fakeTimerAPIs.setImmediate);
(0, (_set_global || _load_set_global()).default)(global, 'setInterval', this._fakeTimerAPIs.setInterval);
(0, (_set_global || _load_set_global()).default)(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` + (0, (_jestMessageUtil || _load_jestMessageUtil()).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(timerRef) {
const uuid = this._timerConfig.refToId(timerRef);
if (uuid && this._timers.hasOwnProperty(uuid)) {
delete this._timers[String(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 this._timerConfig.idToRef(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 this._timerConfig.idToRef(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);
}
}
}
exports.default = FakeTimers;

72
node_modules/jest-util/build/format_test_results.js generated vendored Normal file
View File

@@ -0,0 +1,72 @@
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = formatTestResults;
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 MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*
*/
function formatTestAssertion(assertion) {
const result = {
ancestorTitles: assertion.ancestorTitles,
failureMessages: null,
fullName: assertion.fullName,
location: assertion.location,
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
});
}

84
node_modules/jest-util/build/get_callsite.js generated vendored Normal file
View File

@@ -0,0 +1,84 @@
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _gracefulFs;
function _load_gracefulFs() {
return _gracefulFs = _interopRequireDefault(require('graceful-fs'));
}
var _callsites;
function _load_callsites() {
return _callsites = _interopRequireDefault(require('callsites'));
}
var _sourceMap;
function _load_sourceMap() {
return _sourceMap = require('source-map');
}
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
// Copied from https://github.com/rexxars/sourcemap-decorate-callsites/blob/5b9735a156964973a75dc62fd2c7f0c1975458e8/lib/index.js#L113-L158
/**
* 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 addSourceMapConsumer = (callsite, consumer) => {
const getLineNumber = callsite.getLineNumber;
const getColumnNumber = callsite.getColumnNumber;
let position = null;
function getPosition() {
if (!position) {
position = consumer.originalPositionFor({
column: getColumnNumber.call(callsite),
line: getLineNumber.call(callsite)
});
}
return position;
}
Object.defineProperties(callsite, {
getColumnNumber: {
value() {
return getPosition().column || getColumnNumber.call(callsite);
},
writable: false
},
getLineNumber: {
value() {
return getPosition().line || getLineNumber.call(callsite);
},
writable: false
}
});
};
exports.default = (level, sourceMaps) => {
const levelAfterThisCall = level + 1;
const stack = (0, (_callsites || _load_callsites()).default)()[levelAfterThisCall];
const sourceMapFileName = sourceMaps && sourceMaps[stack.getFileName()];
if (sourceMapFileName) {
try {
const sourceMap = (_gracefulFs || _load_gracefulFs()).default.readFileSync(sourceMapFileName, 'utf8');
addSourceMapConsumer(stack, new (_sourceMap || _load_sourceMap()).SourceMapConsumer(sourceMap));
} catch (e) {
// ignore
}
}
return stack;
};

51
node_modules/jest-util/build/get_console_output.js generated vendored Normal file
View File

@@ -0,0 +1,51 @@
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _path;
function _load_path() {
return _path = _interopRequireDefault(require('path'));
}
var _chalk;
function _load_chalk() {
return _chalk = _interopRequireDefault(require('chalk'));
}
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
exports.default = (root, verbose, buffer) => {
const TITLE_INDENT = verbose ? ' ' : ' ';
const CONSOLE_INDENT = TITLE_INDENT + ' ';
return buffer.reduce((output, _ref) => {
let type = _ref.type,
message = _ref.message,
origin = _ref.origin;
origin = (_path || _load_path()).default.relative(root, origin);
message = message.split(/\n/).map(line => CONSOLE_INDENT + line).join('\n');
let typeMessage = 'console.' + type;
if (type === 'warn') {
message = (_chalk || _load_chalk()).default.yellow(message);
typeMessage = (_chalk || _load_chalk()).default.yellow(typeMessage);
} else if (type === 'error') {
message = (_chalk || _load_chalk()).default.red(message);
typeMessage = (_chalk || _load_chalk()).default.red(typeMessage);
}
return output + TITLE_INDENT + (_chalk || _load_chalk()).default.dim(typeMessage) + ' ' + (_chalk || _load_chalk()).default.dim(origin) + '\n' + message + '\n';
}, '');
}; /**
* 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.
*
*
*/

View File

@@ -0,0 +1,23 @@
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
function getFailedSnapshotTests(testResults) {
const failedTestPaths = [];
if (testResults.numFailedTests === 0 || !testResults.testResults) {
return failedTestPaths;
}
testResults.testResults.forEach(testResult => {
if (testResult.snapshot && testResult.snapshot.unmatched) {
failedTestPaths.push(testResult.testFilePath);
}
});
return failedTestPaths;
}
exports.default = getFailedSnapshotTests;

123
node_modules/jest-util/build/index.js generated vendored Normal file
View File

@@ -0,0 +1,123 @@
'use strict';
var _mkdirp;
function _load_mkdirp() {
return _mkdirp = _interopRequireDefault(require('mkdirp'));
}
var _buffered_console;
function _load_buffered_console() {
return _buffered_console = _interopRequireDefault(require('./buffered_console'));
}
var _clear_line;
function _load_clear_line() {
return _clear_line = _interopRequireDefault(require('./clear_line'));
}
var _Console;
function _load_Console() {
return _Console = _interopRequireDefault(require('./Console'));
}
var _fake_timers;
function _load_fake_timers() {
return _fake_timers = _interopRequireDefault(require('./fake_timers'));
}
var _format_test_results;
function _load_format_test_results() {
return _format_test_results = _interopRequireDefault(require('./format_test_results'));
}
var _get_failed_snapshot_tests;
function _load_get_failed_snapshot_tests() {
return _get_failed_snapshot_tests = _interopRequireDefault(require('./get_failed_snapshot_tests'));
}
var _get_console_output;
function _load_get_console_output() {
return _get_console_output = _interopRequireDefault(require('./get_console_output'));
}
var _install_common_globals;
function _load_install_common_globals() {
return _install_common_globals = _interopRequireDefault(require('./install_common_globals'));
}
var _null_console;
function _load_null_console() {
return _null_console = _interopRequireDefault(require('./null_console'));
}
var _is_interative;
function _load_is_interative() {
return _is_interative = _interopRequireDefault(require('./is_interative'));
}
var _get_callsite;
function _load_get_callsite() {
return _get_callsite = _interopRequireDefault(require('./get_callsite'));
}
var _set_global;
function _load_set_global() {
return _set_global = _interopRequireDefault(require('./set_global'));
}
var _deep_cyclic_copy;
function _load_deep_cyclic_copy() {
return _deep_cyclic_copy = _interopRequireDefault(require('./deep_cyclic_copy'));
}
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 MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*
*/
const createDirectory = path => {
try {
(_mkdirp || _load_mkdirp()).default.sync(path, '777');
} catch (e) {
if (e.code !== 'EEXIST') {
throw e;
}
}
};
module.exports = {
BufferedConsole: (_buffered_console || _load_buffered_console()).default,
Console: (_Console || _load_Console()).default,
FakeTimers: (_fake_timers || _load_fake_timers()).default,
NullConsole: (_null_console || _load_null_console()).default,
clearLine: (_clear_line || _load_clear_line()).default,
createDirectory,
deepCyclicCopy: (_deep_cyclic_copy || _load_deep_cyclic_copy()).default,
formatTestResults: (_format_test_results || _load_format_test_results()).default,
getCallsite: (_get_callsite || _load_get_callsite()).default,
getConsoleOutput: (_get_console_output || _load_get_console_output()).default,
getFailedSnapshotTests: (_get_failed_snapshot_tests || _load_get_failed_snapshot_tests()).default,
installCommonGlobals: (_install_common_globals || _load_install_common_globals()).default,
isInteractive: (_is_interative || _load_is_interative()).default,
setGlobal: (_set_global || _load_set_global()).default
};

55
node_modules/jest-util/build/install_common_globals.js generated vendored Normal file
View File

@@ -0,0 +1,55 @@
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = function (globalObject, globals) {
globalObject.process = (0, (_create_process_object || _load_create_process_object()).default)();
// Keep a reference to "Promise", since "jasmine_light.js" needs it.
globalObject[globalObject.Symbol.for('jest-native-promise')] = Promise;
// Forward some APIs.
DTRACE.forEach(dtrace => {
globalObject[dtrace] = function () {
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
return global[dtrace].apply(this, args);
};
});
// Forward some others (this breaks the sandbox but for now it's OK).
globalObject.Buffer = global.Buffer;
globalObject.setImmediate = global.setImmediate;
globalObject.clearImmediate = global.clearImmediate;
return Object.assign(globalObject, (0, (_deep_cyclic_copy || _load_deep_cyclic_copy()).default)(globals));
};
var _create_process_object;
function _load_create_process_object() {
return _create_process_object = _interopRequireDefault(require('./create_process_object'));
}
var _deep_cyclic_copy;
function _load_deep_cyclic_copy() {
return _deep_cyclic_copy = _interopRequireDefault(require('./deep_cyclic_copy'));
}
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 MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*
*/
const DTRACE = Object.keys(global).filter(key => key.startsWith('DTRACE'));

15
node_modules/jest-util/build/is_interative.js generated vendored Normal file
View File

@@ -0,0 +1,15 @@
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _isCi;
function _load_isCi() {
return _isCi = _interopRequireDefault(require('is-ci'));
}
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
exports.default = process.stdout.isTTY && process.env.TERM !== 'dumb' && !(_isCi || _load_isCi()).default;

34
node_modules/jest-util/build/null_console.js generated vendored Normal file
View File

@@ -0,0 +1,34 @@
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _Console;
function _load_Console() {
return _Console = _interopRequireDefault(require('./Console'));
}
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
class NullConsole extends (_Console || _load_Console()).default {
assert() {}
debug() {}
dir() {}
error() {}
info() {}
log() {}
time() {}
timeEnd() {}
trace() {}
warn() {}
}
exports.default = NullConsole; /**
* 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.
*
*
*/

14
node_modules/jest-util/build/set_global.js generated vendored Normal file
View File

@@ -0,0 +1,14 @@
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = (global, key, value) => global[key] = value; /**
* 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.
*
*
*/