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,221 @@
'use strict';var _set = require('babel-runtime/core-js/set');var _set2 = _interopRequireDefault(_set);var _map = require('babel-runtime/core-js/map');var _map2 = _interopRequireDefault(_map);var _typeof2 = require('babel-runtime/helpers/typeof');var _typeof3 = _interopRequireDefault(_typeof2);function _interopRequireDefault(obj) {return obj && obj.__esModule ? obj : { default: obj };} /**
* 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 chalk = require('chalk');
var prettyFormat = require('pretty-format');var _require$plugins =
require('pretty-format').plugins,AsymmetricMatcher = _require$plugins.AsymmetricMatcher,ReactElement = _require$plugins.ReactElement,HTMLElement = _require$plugins.HTMLElement,Immutable = _require$plugins.Immutable;
var PLUGINS = [AsymmetricMatcher, ReactElement, HTMLElement].concat(
Immutable);
var EXPECTED_COLOR = chalk.green;
var EXPECTED_BG = chalk.bgGreen;
var RECEIVED_COLOR = chalk.red;
var RECEIVED_BG = chalk.bgRed;
var NUMBERS = [
'zero',
'one',
'two',
'three',
'four',
'five',
'six',
'seven',
'eight',
'nine',
'ten',
'eleven',
'twelve',
'thirteen'];
// get the type of a value with handling the edge cases like `typeof []`
// and `typeof null`
var getType = function getType(value) {
if (typeof value === 'undefined') {
return 'undefined';
} else if (value === null) {
return 'null';
} else if (Array.isArray(value)) {
return 'array';
} else if (typeof value === 'boolean') {
return 'boolean';
} else if (typeof value === 'function') {
return 'function';
} else if (typeof value === 'number') {
return 'number';
} else if (typeof value === 'string') {
return 'string';
} else if ((typeof value === 'undefined' ? 'undefined' : (0, _typeof3.default)(value)) === 'object') {
if (value.constructor === RegExp) {
return 'regexp';
} else if (value.constructor === _map2.default) {
return 'map';
} else if (value.constructor === _set2.default) {
return 'set';
}
return 'object';
// $FlowFixMe https://github.com/facebook/flow/issues/1015
} else if ((typeof value === 'undefined' ? 'undefined' : (0, _typeof3.default)(value)) === 'symbol') {
return 'symbol';
}
throw new Error('value of unknown type: ' + value);
};
var stringify = function stringify(object) {var maxDepth = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 10;
var MAX_LENGTH = 10000;
var result = void 0;
try {
result = prettyFormat(object, {
maxDepth: maxDepth,
min: true,
plugins: PLUGINS });
} catch (e) {
result = prettyFormat(object, {
callToJSON: false,
maxDepth: maxDepth,
min: true,
plugins: PLUGINS });
}
return result.length >= MAX_LENGTH && maxDepth > 1 ?
stringify(object, Math.floor(maxDepth / 2)) :
result;
};
var highlightTrailingWhitespace = function highlightTrailingWhitespace(text, bgColor) {return (
text.replace(/\s+$/gm, bgColor('$&')));};
var printReceived = function printReceived(object) {return (
highlightTrailingWhitespace(RECEIVED_COLOR(stringify(object)), RECEIVED_BG));};
var printExpected = function printExpected(value) {return (
highlightTrailingWhitespace(EXPECTED_COLOR(stringify(value)), EXPECTED_BG));};
var printWithType = function printWithType(
name,
received,
print)
{
var type = getType(received);
return (
name +
':' + (
type !== 'null' && type !== 'undefined' ? '\n ' + type + ': ' : ' ') +
print(received));
};
var ensureNoExpected = function ensureNoExpected(expected, matcherName) {
matcherName || (matcherName = 'This');
if (typeof expected !== 'undefined') {
throw new Error(
matcherHint('[.not]' + matcherName, undefined, '') +
'\n\n' +
'Matcher does not accept any arguments.\n' +
printWithType('Got', expected, printExpected));
}
};
var ensureActualIsNumber = function ensureActualIsNumber(actual, matcherName) {
matcherName || (matcherName = 'This matcher');
if (typeof actual !== 'number') {
throw new Error(
matcherHint('[.not]' + matcherName) +
'\n\n' + 'Received value must be a number.\n' +
printWithType('Received', actual, printReceived));
}
};
var ensureExpectedIsNumber = function ensureExpectedIsNumber(expected, matcherName) {
matcherName || (matcherName = 'This matcher');
if (typeof expected !== 'number') {
throw new Error(
matcherHint('[.not]' + matcherName) +
'\n\n' + 'Expected value must be a number.\n' +
printWithType('Got', expected, printExpected));
}
};
var ensureNumbers = function ensureNumbers(actual, expected, matcherName) {
ensureActualIsNumber(actual, matcherName);
ensureExpectedIsNumber(expected, matcherName);
};
var pluralize = function pluralize(word, count) {return (
(NUMBERS[count] || count) + ' ' + word + (count === 1 ? '' : 's'));};
var matcherHint = function matcherHint(
matcherName)
{var received = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'received';var expected = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'expected';var options = arguments[3];
var secondArgument = options && options.secondArgument;
var isDirectExpectCall = options && options.isDirectExpectCall;
return (
chalk.dim('expect' + (isDirectExpectCall ? '' : '(')) +
RECEIVED_COLOR(received) +
chalk.dim((isDirectExpectCall ? '' : ')') + matcherName + '(') +
EXPECTED_COLOR(expected) + (
secondArgument ? ', ' + EXPECTED_COLOR(secondArgument) : '') +
chalk.dim(')'));
};
module.exports = {
EXPECTED_BG: EXPECTED_BG,
EXPECTED_COLOR: EXPECTED_COLOR,
RECEIVED_BG: RECEIVED_BG,
RECEIVED_COLOR: RECEIVED_COLOR,
ensureActualIsNumber: ensureActualIsNumber,
ensureExpectedIsNumber: ensureExpectedIsNumber,
ensureNoExpected: ensureNoExpected,
ensureNumbers: ensureNumbers,
getType: getType,
highlightTrailingWhitespace: highlightTrailingWhitespace,
matcherHint: matcherHint,
pluralize: pluralize,
printExpected: printExpected,
printReceived: printReceived,
printWithType: printWithType,
stringify: stringify };

View File

@@ -0,0 +1,221 @@
'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 chalk = require('chalk');
const prettyFormat = require('pretty-format');var _require$plugins =
require('pretty-format').plugins;const AsymmetricMatcher = _require$plugins.AsymmetricMatcher,ReactElement = _require$plugins.ReactElement,HTMLElement = _require$plugins.HTMLElement,Immutable = _require$plugins.Immutable;
const PLUGINS = [AsymmetricMatcher, ReactElement, HTMLElement].concat(
Immutable);
const EXPECTED_COLOR = chalk.green;
const EXPECTED_BG = chalk.bgGreen;
const RECEIVED_COLOR = chalk.red;
const RECEIVED_BG = chalk.bgRed;
const NUMBERS = [
'zero',
'one',
'two',
'three',
'four',
'five',
'six',
'seven',
'eight',
'nine',
'ten',
'eleven',
'twelve',
'thirteen'];
// get the type of a value with handling the edge cases like `typeof []`
// and `typeof null`
const getType = value => {
if (typeof value === 'undefined') {
return 'undefined';
} else if (value === null) {
return 'null';
} else if (Array.isArray(value)) {
return 'array';
} else if (typeof value === 'boolean') {
return 'boolean';
} else if (typeof value === 'function') {
return 'function';
} else if (typeof value === 'number') {
return 'number';
} else if (typeof value === 'string') {
return 'string';
} else if (typeof value === 'object') {
if (value.constructor === RegExp) {
return 'regexp';
} else if (value.constructor === Map) {
return 'map';
} else if (value.constructor === Set) {
return 'set';
}
return 'object';
// $FlowFixMe https://github.com/facebook/flow/issues/1015
} else if (typeof value === 'symbol') {
return 'symbol';
}
throw new Error(`value of unknown type: ${value}`);
};
const stringify = function (object) {let maxDepth = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 10;
const MAX_LENGTH = 10000;
let result;
try {
result = prettyFormat(object, {
maxDepth,
min: true,
plugins: PLUGINS });
} catch (e) {
result = prettyFormat(object, {
callToJSON: false,
maxDepth,
min: true,
plugins: PLUGINS });
}
return result.length >= MAX_LENGTH && maxDepth > 1 ?
stringify(object, Math.floor(maxDepth / 2)) :
result;
};
const highlightTrailingWhitespace = (text, bgColor) =>
text.replace(/\s+$/gm, bgColor('$&'));
const printReceived = object =>
highlightTrailingWhitespace(RECEIVED_COLOR(stringify(object)), RECEIVED_BG);
const printExpected = value =>
highlightTrailingWhitespace(EXPECTED_COLOR(stringify(value)), EXPECTED_BG);
const printWithType = (
name,
received,
print) =>
{
const type = getType(received);
return (
name +
':' + (
type !== 'null' && type !== 'undefined' ? '\n ' + type + ': ' : ' ') +
print(received));
};
const ensureNoExpected = (expected, matcherName) => {
matcherName || (matcherName = 'This');
if (typeof expected !== 'undefined') {
throw new Error(
matcherHint('[.not]' + matcherName, undefined, '') +
'\n\n' +
'Matcher does not accept any arguments.\n' +
printWithType('Got', expected, printExpected));
}
};
const ensureActualIsNumber = (actual, matcherName) => {
matcherName || (matcherName = 'This matcher');
if (typeof actual !== 'number') {
throw new Error(
matcherHint('[.not]' + matcherName) +
'\n\n' +
`Received value must be a number.\n` +
printWithType('Received', actual, printReceived));
}
};
const ensureExpectedIsNumber = (expected, matcherName) => {
matcherName || (matcherName = 'This matcher');
if (typeof expected !== 'number') {
throw new Error(
matcherHint('[.not]' + matcherName) +
'\n\n' +
`Expected value must be a number.\n` +
printWithType('Got', expected, printExpected));
}
};
const ensureNumbers = (actual, expected, matcherName) => {
ensureActualIsNumber(actual, matcherName);
ensureExpectedIsNumber(expected, matcherName);
};
const pluralize = (word, count) =>
(NUMBERS[count] || count) + ' ' + word + (count === 1 ? '' : 's');
const matcherHint = function (
matcherName)
{let received = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'received';let expected = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'expected';let options = arguments[3];
const secondArgument = options && options.secondArgument;
const isDirectExpectCall = options && options.isDirectExpectCall;
return (
chalk.dim('expect' + (isDirectExpectCall ? '' : '(')) +
RECEIVED_COLOR(received) +
chalk.dim((isDirectExpectCall ? '' : ')') + matcherName + '(') +
EXPECTED_COLOR(expected) + (
secondArgument ? `, ${EXPECTED_COLOR(secondArgument)}` : '') +
chalk.dim(')'));
};
module.exports = {
EXPECTED_BG,
EXPECTED_COLOR,
RECEIVED_BG,
RECEIVED_COLOR,
ensureActualIsNumber,
ensureExpectedIsNumber,
ensureNoExpected,
ensureNumbers,
getType,
highlightTrailingWhitespace,
matcherHint,
pluralize,
printExpected,
printReceived,
printWithType,
stringify };

View File

@@ -0,0 +1,53 @@
{
"_args": [
[
"jest-matcher-utils@20.0.3",
"C:\\Users\\deranjer\\go\\src\\github.com\\deranjer\\goTorrent\\torrent-project"
]
],
"_from": "jest-matcher-utils@20.0.3",
"_id": "jest-matcher-utils@20.0.3",
"_inBundle": false,
"_integrity": "sha1-s6a443yld4A7CDKpixZPRLeBVhI=",
"_location": "/react-scripts/jest-matcher-utils",
"_phantomChildren": {},
"_requested": {
"type": "version",
"registry": true,
"raw": "jest-matcher-utils@20.0.3",
"name": "jest-matcher-utils",
"escapedName": "jest-matcher-utils",
"rawSpec": "20.0.3",
"saveSpec": null,
"fetchSpec": "20.0.3"
},
"_requiredBy": [
"/react-scripts/jest-config",
"/react-scripts/jest-diff",
"/react-scripts/jest-jasmine2",
"/react-scripts/jest-matchers",
"/react-scripts/jest-snapshot",
"/react-scripts/jest-validate"
],
"_resolved": "https://registry.npmjs.org/jest-matcher-utils/-/jest-matcher-utils-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",
"pretty-format": "^20.0.3"
},
"description": "A set of utility functions for jest-matchers and related packages",
"homepage": "https://github.com/facebook/jest#readme",
"license": "BSD-3-Clause",
"main": "build/index.js",
"name": "jest-matcher-utils",
"repository": {
"type": "git",
"url": "git+https://github.com/facebook/jest.git"
},
"version": "20.0.3"
}