mirror of
https://code.forgejo.org/actions/setup-node.git
synced 2025-05-20 21:14:45 +00:00
.
This commit is contained in:
parent
fc725ba36b
commit
422b9fdb15
7395 changed files with 1786235 additions and 3476 deletions
23
node_modules/pretty-format/LICENSE
generated
vendored
Normal file
23
node_modules/pretty-format/LICENSE
generated
vendored
Normal file
|
@ -0,0 +1,23 @@
|
|||
MIT License
|
||||
|
||||
For Jest software
|
||||
|
||||
Copyright (c) 2014-present, Facebook, Inc.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
463
node_modules/pretty-format/README.md
generated
vendored
Executable file
463
node_modules/pretty-format/README.md
generated
vendored
Executable file
|
@ -0,0 +1,463 @@
|
|||
# pretty-format
|
||||
|
||||
> Stringify any JavaScript value.
|
||||
|
||||
- Supports all built-in JavaScript types
|
||||
- primitive types: `Boolean`, `null`, `Number`, `String`, `Symbol`, `undefined`
|
||||
- other non-collection types: `Date`, `Error`, `Function`, `RegExp`
|
||||
- collection types:
|
||||
- `arguments`, `Array`, `ArrayBuffer`, `DataView`, `Float32Array`, `Float64Array`, `Int8Array`, `Int16Array`, `Int32Array`, `Uint8Array`, `Uint8ClampedArray`, `Uint16Array`, `Uint32Array`,
|
||||
- `Map`, `Set`, `WeakMap`, `WeakSet`
|
||||
- `Object`
|
||||
- [Blazingly fast](https://gist.github.com/thejameskyle/2b04ffe4941aafa8f970de077843a8fd)
|
||||
- similar performance to `JSON.stringify` in v8
|
||||
- significantly faster than `util.format` in Node.js
|
||||
- Serialize application-specific data types with built-in or user-defined plugins
|
||||
|
||||
## Installation
|
||||
|
||||
```sh
|
||||
$ yarn add pretty-format
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
const prettyFormat = require('pretty-format'); // CommonJS
|
||||
```
|
||||
|
||||
```js
|
||||
import prettyFormat from 'pretty-format'; // ES2015 modules
|
||||
```
|
||||
|
||||
```js
|
||||
const val = {object: {}};
|
||||
val.circularReference = val;
|
||||
val[Symbol('foo')] = 'foo';
|
||||
val.map = new Map([['prop', 'value']]);
|
||||
val.array = [-0, Infinity, NaN];
|
||||
|
||||
console.log(prettyFormat(val));
|
||||
/*
|
||||
Object {
|
||||
"array": Array [
|
||||
-0,
|
||||
Infinity,
|
||||
NaN,
|
||||
],
|
||||
"circularReference": [Circular],
|
||||
"map": Map {
|
||||
"prop" => "value",
|
||||
},
|
||||
"object": Object {},
|
||||
Symbol(foo): "foo",
|
||||
}
|
||||
*/
|
||||
```
|
||||
|
||||
## Usage with options
|
||||
|
||||
```js
|
||||
function onClick() {}
|
||||
|
||||
console.log(prettyFormat(onClick));
|
||||
/*
|
||||
[Function onClick]
|
||||
*/
|
||||
|
||||
const options = {
|
||||
printFunctionName: false,
|
||||
};
|
||||
console.log(prettyFormat(onClick, options));
|
||||
/*
|
||||
[Function]
|
||||
*/
|
||||
```
|
||||
|
||||
| key | type | default | description |
|
||||
| :------------------ | :-------- | :--------- | :------------------------------------------------------ |
|
||||
| `callToJSON` | `boolean` | `true` | call `toJSON` method (if it exists) on objects |
|
||||
| `escapeRegex` | `boolean` | `false` | escape special characters in regular expressions |
|
||||
| `escapeString` | `boolean` | `true` | escape special characters in strings |
|
||||
| `highlight` | `boolean` | `false` | highlight syntax with colors in terminal (some plugins) |
|
||||
| `indent` | `number` | `2` | spaces in each level of indentation |
|
||||
| `maxDepth` | `number` | `Infinity` | levels to print in arrays, objects, elements, and so on |
|
||||
| `min` | `boolean` | `false` | minimize added space: no indentation nor line breaks |
|
||||
| `plugins` | `array` | `[]` | plugins to serialize application-specific data types |
|
||||
| `printFunctionName` | `boolean` | `true` | include or omit the name of a function |
|
||||
| `theme` | `object` | | colors to highlight syntax in terminal |
|
||||
|
||||
Property values of `theme` are from [ansi-styles colors](https://github.com/chalk/ansi-styles#colors)
|
||||
|
||||
```js
|
||||
const DEFAULT_THEME = {
|
||||
comment: 'gray',
|
||||
content: 'reset',
|
||||
prop: 'yellow',
|
||||
tag: 'cyan',
|
||||
value: 'green',
|
||||
};
|
||||
```
|
||||
|
||||
## Usage with plugins
|
||||
|
||||
The `pretty-format` package provides some built-in plugins, including:
|
||||
|
||||
- `ReactElement` for elements from `react`
|
||||
- `ReactTestComponent` for test objects from `react-test-renderer`
|
||||
|
||||
```js
|
||||
// CommonJS
|
||||
const prettyFormat = require('pretty-format');
|
||||
const ReactElement = prettyFormat.plugins.ReactElement;
|
||||
const ReactTestComponent = prettyFormat.plugins.ReactTestComponent;
|
||||
|
||||
const React = require('react');
|
||||
const renderer = require('react-test-renderer');
|
||||
```
|
||||
|
||||
```js
|
||||
// ES2015 modules and destructuring assignment
|
||||
import prettyFormat from 'pretty-format';
|
||||
const {ReactElement, ReactTestComponent} = prettyFormat.plugins;
|
||||
|
||||
import React from 'react';
|
||||
import renderer from 'react-test-renderer';
|
||||
```
|
||||
|
||||
```js
|
||||
const onClick = () => {};
|
||||
const element = React.createElement('button', {onClick}, 'Hello World');
|
||||
|
||||
const formatted1 = prettyFormat(element, {
|
||||
plugins: [ReactElement],
|
||||
printFunctionName: false,
|
||||
});
|
||||
const formatted2 = prettyFormat(renderer.create(element).toJSON(), {
|
||||
plugins: [ReactTestComponent],
|
||||
printFunctionName: false,
|
||||
});
|
||||
/*
|
||||
<button
|
||||
onClick=[Function]
|
||||
>
|
||||
Hello World
|
||||
</button>
|
||||
*/
|
||||
```
|
||||
|
||||
## Usage in Jest
|
||||
|
||||
For snapshot tests, Jest uses `pretty-format` with options that include some of its built-in plugins. For this purpose, plugins are also known as **snapshot serializers**.
|
||||
|
||||
To serialize application-specific data types, you can add modules to `devDependencies` of a project, and then:
|
||||
|
||||
In an **individual** test file, you can add a module as follows. It precedes any modules from Jest configuration.
|
||||
|
||||
```js
|
||||
import serializer from 'my-serializer-module';
|
||||
expect.addSnapshotSerializer(serializer);
|
||||
|
||||
// tests which have `expect(value).toMatchSnapshot()` assertions
|
||||
```
|
||||
|
||||
For **all** test files, you can specify modules in Jest configuration. They precede built-in plugins for React, HTML, and Immutable.js data types. For example, in a `package.json` file:
|
||||
|
||||
```json
|
||||
{
|
||||
"jest": {
|
||||
"snapshotSerializers": ["my-serializer-module"]
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Writing plugins
|
||||
|
||||
A plugin is a JavaScript object.
|
||||
|
||||
If `options` has a `plugins` array: for the first plugin whose `test(val)` method returns a truthy value, then `prettyFormat(val, options)` returns the result from either:
|
||||
|
||||
- `serialize(val, …)` method of the **improved** interface (available in **version 21** or later)
|
||||
- `print(val, …)` method of the **original** interface (if plugin does not have `serialize` method)
|
||||
|
||||
### test
|
||||
|
||||
Write `test` so it can receive `val` argument of any type. To serialize **objects** which have certain properties, then a guarded expression like `val != null && …` or more concise `val && …` prevents the following errors:
|
||||
|
||||
- `TypeError: Cannot read property 'whatever' of null`
|
||||
- `TypeError: Cannot read property 'whatever' of undefined`
|
||||
|
||||
For example, `test` method of built-in `ReactElement` plugin:
|
||||
|
||||
```js
|
||||
const elementSymbol = Symbol.for('react.element');
|
||||
const test = val => val && val.$$typeof === elementSymbol;
|
||||
```
|
||||
|
||||
Pay attention to efficiency in `test` because `pretty-format` calls it often.
|
||||
|
||||
### serialize
|
||||
|
||||
The **improved** interface is available in **version 21** or later.
|
||||
|
||||
Write `serialize` to return a string, given the arguments:
|
||||
|
||||
- `val` which “passed the test”
|
||||
- unchanging `config` object: derived from `options`
|
||||
- current `indentation` string: concatenate to `indent` from `config`
|
||||
- current `depth` number: compare to `maxDepth` from `config`
|
||||
- current `refs` array: find circular references in objects
|
||||
- `printer` callback function: serialize children
|
||||
|
||||
### config
|
||||
|
||||
| key | type | description |
|
||||
| :------------------ | :-------- | :------------------------------------------------------ |
|
||||
| `callToJSON` | `boolean` | call `toJSON` method (if it exists) on objects |
|
||||
| `colors` | `Object` | escape codes for colors to highlight syntax |
|
||||
| `escapeRegex` | `boolean` | escape special characters in regular expressions |
|
||||
| `escapeString` | `boolean` | escape special characters in strings |
|
||||
| `indent` | `string` | spaces in each level of indentation |
|
||||
| `maxDepth` | `number` | levels to print in arrays, objects, elements, and so on |
|
||||
| `min` | `boolean` | minimize added space: no indentation nor line breaks |
|
||||
| `plugins` | `array` | plugins to serialize application-specific data types |
|
||||
| `printFunctionName` | `boolean` | include or omit the name of a function |
|
||||
| `spacingInner` | `strong` | spacing to separate items in a list |
|
||||
| `spacingOuter` | `strong` | spacing to enclose a list of items |
|
||||
|
||||
Each property of `colors` in `config` corresponds to a property of `theme` in `options`:
|
||||
|
||||
- the key is the same (for example, `tag`)
|
||||
- the value in `colors` is a object with `open` and `close` properties whose values are escape codes from [ansi-styles](https://github.com/chalk/ansi-styles) for the color value in `theme` (for example, `'cyan'`)
|
||||
|
||||
Some properties in `config` are derived from `min` in `options`:
|
||||
|
||||
- `spacingInner` and `spacingOuter` are **newline** if `min` is `false`
|
||||
- `spacingInner` is **space** and `spacingOuter` is **empty string** if `min` is `true`
|
||||
|
||||
### Example of serialize and test
|
||||
|
||||
This plugin is a pattern you can apply to serialize composite data types. Of course, `pretty-format` does not need a plugin to serialize arrays :)
|
||||
|
||||
```js
|
||||
// We reused more code when we factored out a function for child items
|
||||
// that is independent of depth, name, and enclosing punctuation (see below).
|
||||
const SEPARATOR = ',';
|
||||
function serializeItems(items, config, indentation, depth, refs, printer) {
|
||||
if (items.length === 0) {
|
||||
return '';
|
||||
}
|
||||
const indentationItems = indentation + config.indent;
|
||||
return (
|
||||
config.spacingOuter +
|
||||
items
|
||||
.map(
|
||||
item =>
|
||||
indentationItems +
|
||||
printer(item, config, indentationItems, depth, refs), // callback
|
||||
)
|
||||
.join(SEPARATOR + config.spacingInner) +
|
||||
(config.min ? '' : SEPARATOR) + // following the last item
|
||||
config.spacingOuter +
|
||||
indentation
|
||||
);
|
||||
}
|
||||
|
||||
const plugin = {
|
||||
test(val) {
|
||||
return Array.isArray(val);
|
||||
},
|
||||
serialize(array, config, indentation, depth, refs, printer) {
|
||||
const name = array.constructor.name;
|
||||
return ++depth > config.maxDepth
|
||||
? '[' + name + ']'
|
||||
: (config.min ? '' : name + ' ') +
|
||||
'[' +
|
||||
serializeItems(array, config, indentation, depth, refs, printer) +
|
||||
']';
|
||||
},
|
||||
};
|
||||
```
|
||||
|
||||
```js
|
||||
const val = {
|
||||
filter: 'completed',
|
||||
items: [
|
||||
{
|
||||
text: 'Write test',
|
||||
completed: true,
|
||||
},
|
||||
{
|
||||
text: 'Write serialize',
|
||||
completed: true,
|
||||
},
|
||||
],
|
||||
};
|
||||
```
|
||||
|
||||
```js
|
||||
console.log(
|
||||
prettyFormat(val, {
|
||||
plugins: [plugin],
|
||||
}),
|
||||
);
|
||||
/*
|
||||
Object {
|
||||
"filter": "completed",
|
||||
"items": Array [
|
||||
Object {
|
||||
"completed": true,
|
||||
"text": "Write test",
|
||||
},
|
||||
Object {
|
||||
"completed": true,
|
||||
"text": "Write serialize",
|
||||
},
|
||||
],
|
||||
}
|
||||
*/
|
||||
```
|
||||
|
||||
```js
|
||||
console.log(
|
||||
prettyFormat(val, {
|
||||
indent: 4,
|
||||
plugins: [plugin],
|
||||
}),
|
||||
);
|
||||
/*
|
||||
Object {
|
||||
"filter": "completed",
|
||||
"items": Array [
|
||||
Object {
|
||||
"completed": true,
|
||||
"text": "Write test",
|
||||
},
|
||||
Object {
|
||||
"completed": true,
|
||||
"text": "Write serialize",
|
||||
},
|
||||
],
|
||||
}
|
||||
*/
|
||||
```
|
||||
|
||||
```js
|
||||
console.log(
|
||||
prettyFormat(val, {
|
||||
maxDepth: 1,
|
||||
plugins: [plugin],
|
||||
}),
|
||||
);
|
||||
/*
|
||||
Object {
|
||||
"filter": "completed",
|
||||
"items": [Array],
|
||||
}
|
||||
*/
|
||||
```
|
||||
|
||||
```js
|
||||
console.log(
|
||||
prettyFormat(val, {
|
||||
min: true,
|
||||
plugins: [plugin],
|
||||
}),
|
||||
);
|
||||
/*
|
||||
{"filter": "completed", "items": [{"completed": true, "text": "Write test"}, {"completed": true, "text": "Write serialize"}]}
|
||||
*/
|
||||
```
|
||||
|
||||
### print
|
||||
|
||||
The **original** interface is adequate for plugins:
|
||||
|
||||
- that **do not** depend on options other than `highlight` or `min`
|
||||
- that **do not** depend on `depth` or `refs` in recursive traversal, and
|
||||
- if values either
|
||||
- do **not** require indentation, or
|
||||
- do **not** occur as children of JavaScript data structures (for example, array)
|
||||
|
||||
Write `print` to return a string, given the arguments:
|
||||
|
||||
- `val` which “passed the test”
|
||||
- current `printer(valChild)` callback function: serialize children
|
||||
- current `indenter(lines)` callback function: indent lines at the next level
|
||||
- unchanging `config` object: derived from `options`
|
||||
- unchanging `colors` object: derived from `options`
|
||||
|
||||
The 3 properties of `config` are `min` in `options` and:
|
||||
|
||||
- `spacing` and `edgeSpacing` are **newline** if `min` is `false`
|
||||
- `spacing` is **space** and `edgeSpacing` is **empty string** if `min` is `true`
|
||||
|
||||
Each property of `colors` corresponds to a property of `theme` in `options`:
|
||||
|
||||
- the key is the same (for example, `tag`)
|
||||
- the value in `colors` is a object with `open` and `close` properties whose values are escape codes from [ansi-styles](https://github.com/chalk/ansi-styles) for the color value in `theme` (for example, `'cyan'`)
|
||||
|
||||
### Example of print and test
|
||||
|
||||
This plugin prints functions with the **number of named arguments** excluding rest argument.
|
||||
|
||||
```js
|
||||
const plugin = {
|
||||
print(val) {
|
||||
return `[Function ${val.name || 'anonymous'} ${val.length}]`;
|
||||
},
|
||||
test(val) {
|
||||
return typeof val === 'function';
|
||||
},
|
||||
};
|
||||
```
|
||||
|
||||
```js
|
||||
const val = {
|
||||
onClick(event) {},
|
||||
render() {},
|
||||
};
|
||||
|
||||
prettyFormat(val, {
|
||||
plugins: [plugin],
|
||||
});
|
||||
/*
|
||||
Object {
|
||||
"onClick": [Function onClick 1],
|
||||
"render": [Function render 0],
|
||||
}
|
||||
*/
|
||||
|
||||
prettyFormat(val);
|
||||
/*
|
||||
Object {
|
||||
"onClick": [Function onClick],
|
||||
"render": [Function render],
|
||||
}
|
||||
*/
|
||||
```
|
||||
|
||||
This plugin **ignores** the `printFunctionName` option. That limitation of the original `print` interface is a reason to use the improved `serialize` interface, described above.
|
||||
|
||||
```js
|
||||
prettyFormat(val, {
|
||||
plugins: [pluginOld],
|
||||
printFunctionName: false,
|
||||
});
|
||||
/*
|
||||
Object {
|
||||
"onClick": [Function onClick 1],
|
||||
"render": [Function render 0],
|
||||
}
|
||||
*/
|
||||
|
||||
prettyFormat(val, {
|
||||
printFunctionName: false,
|
||||
});
|
||||
/*
|
||||
Object {
|
||||
"onClick": [Function],
|
||||
"render": [Function],
|
||||
}
|
||||
*/
|
||||
```
|
3263
node_modules/pretty-format/build-es5/index.js
generated
vendored
Normal file
3263
node_modules/pretty-format/build-es5/index.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load diff
1
node_modules/pretty-format/build-es5/index.js.map
generated
vendored
Normal file
1
node_modules/pretty-format/build-es5/index.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
33
node_modules/pretty-format/build/collections.d.ts
generated
vendored
Normal file
33
node_modules/pretty-format/build/collections.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,33 @@
|
|||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates. 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.
|
||||
*
|
||||
*/
|
||||
import { Config, Printer, Refs } from './types';
|
||||
/**
|
||||
* Return entries (for example, of a map)
|
||||
* with spacing, indentation, and comma
|
||||
* without surrounding punctuation (for example, braces)
|
||||
*/
|
||||
export declare function printIteratorEntries(iterator: any, config: Config, indentation: string, depth: number, refs: Refs, printer: Printer, separator?: string): string;
|
||||
/**
|
||||
* Return values (for example, of a set)
|
||||
* with spacing, indentation, and comma
|
||||
* without surrounding punctuation (braces or brackets)
|
||||
*/
|
||||
export declare function printIteratorValues(iterator: Iterator<any>, config: Config, indentation: string, depth: number, refs: Refs, printer: Printer): string;
|
||||
/**
|
||||
* Return items (for example, of an array)
|
||||
* with spacing, indentation, and comma
|
||||
* without surrounding punctuation (for example, brackets)
|
||||
**/
|
||||
export declare function printListItems(list: any, config: Config, indentation: string, depth: number, refs: Refs, printer: Printer): string;
|
||||
/**
|
||||
* Return properties of an object
|
||||
* with spacing, indentation, and comma
|
||||
* without surrounding punctuation (for example, braces)
|
||||
*/
|
||||
export declare function printObjectProperties(val: Record<string, any>, config: Config, indentation: string, depth: number, refs: Refs, printer: Printer): string;
|
||||
//# sourceMappingURL=collections.d.ts.map
|
1
node_modules/pretty-format/build/collections.d.ts.map
generated
vendored
Normal file
1
node_modules/pretty-format/build/collections.d.ts.map
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"collections.d.ts","sourceRoot":"","sources":["../src/collections.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAC,MAAM,EAAE,OAAO,EAAE,IAAI,EAAC,MAAM,SAAS,CAAC;AAgB9C;;;;GAIG;AACH,wBAAgB,oBAAoB,CAIlC,QAAQ,EAAE,GAAG,EACb,MAAM,EAAE,MAAM,EACd,WAAW,EAAE,MAAM,EACnB,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,OAAO,EAIhB,SAAS,GAAE,MAAa,GACvB,MAAM,CAwCR;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CACjC,QAAQ,EAAE,QAAQ,CAAC,GAAG,CAAC,EACvB,MAAM,EAAE,MAAM,EACd,WAAW,EAAE,MAAM,EACnB,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,OAAO,GACf,MAAM,CA2BR;AAED;;;;IAII;AACJ,wBAAgB,cAAc,CAC5B,IAAI,EAAE,GAAG,EACT,MAAM,EAAE,MAAM,EACd,WAAW,EAAE,MAAM,EACnB,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,OAAO,GACf,MAAM,CAwBR;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,CACnC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EACxB,MAAM,EAAE,MAAM,EACd,WAAW,EAAE,MAAM,EACnB,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,OAAO,GACf,MAAM,CAiCR"}
|
185
node_modules/pretty-format/build/collections.js
generated
vendored
Normal file
185
node_modules/pretty-format/build/collections.js
generated
vendored
Normal file
|
@ -0,0 +1,185 @@
|
|||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', {
|
||||
value: true
|
||||
});
|
||||
exports.printIteratorEntries = printIteratorEntries;
|
||||
exports.printIteratorValues = printIteratorValues;
|
||||
exports.printListItems = printListItems;
|
||||
exports.printObjectProperties = printObjectProperties;
|
||||
|
||||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates. 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 getKeysOfEnumerableProperties = object => {
|
||||
const keys = Object.keys(object).sort();
|
||||
|
||||
if (Object.getOwnPropertySymbols) {
|
||||
Object.getOwnPropertySymbols(object).forEach(symbol => {
|
||||
if (Object.getOwnPropertyDescriptor(object, symbol).enumerable) {
|
||||
keys.push(symbol);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return keys;
|
||||
};
|
||||
/**
|
||||
* Return entries (for example, of a map)
|
||||
* with spacing, indentation, and comma
|
||||
* without surrounding punctuation (for example, braces)
|
||||
*/
|
||||
|
||||
function printIteratorEntries( // Flow 0.51.0: property `@@iterator` of $Iterator not found in Object
|
||||
// To allow simplistic getRecordIterator in immutable.js
|
||||
iterator,
|
||||
config,
|
||||
indentation,
|
||||
depth,
|
||||
refs,
|
||||
printer, // Too bad, so sad that separator for ECMAScript Map has been ' => '
|
||||
// What a distracting diff if you change a data structure to/from
|
||||
separator = ': '
|
||||
) {
|
||||
let result = '';
|
||||
let current = iterator.next();
|
||||
|
||||
if (!current.done) {
|
||||
result += config.spacingOuter;
|
||||
const indentationNext = indentation + config.indent;
|
||||
|
||||
while (!current.done) {
|
||||
const name = printer(
|
||||
current.value[0],
|
||||
config,
|
||||
indentationNext,
|
||||
depth,
|
||||
refs
|
||||
);
|
||||
const value = printer(
|
||||
current.value[1],
|
||||
config,
|
||||
indentationNext,
|
||||
depth,
|
||||
refs
|
||||
);
|
||||
result += indentationNext + name + separator + value;
|
||||
current = iterator.next();
|
||||
|
||||
if (!current.done) {
|
||||
result += ',' + config.spacingInner;
|
||||
} else if (!config.min) {
|
||||
result += ',';
|
||||
}
|
||||
}
|
||||
|
||||
result += config.spacingOuter + indentation;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
/**
|
||||
* Return values (for example, of a set)
|
||||
* with spacing, indentation, and comma
|
||||
* without surrounding punctuation (braces or brackets)
|
||||
*/
|
||||
|
||||
function printIteratorValues(
|
||||
iterator,
|
||||
config,
|
||||
indentation,
|
||||
depth,
|
||||
refs,
|
||||
printer
|
||||
) {
|
||||
let result = '';
|
||||
let current = iterator.next();
|
||||
|
||||
if (!current.done) {
|
||||
result += config.spacingOuter;
|
||||
const indentationNext = indentation + config.indent;
|
||||
|
||||
while (!current.done) {
|
||||
result +=
|
||||
indentationNext +
|
||||
printer(current.value, config, indentationNext, depth, refs);
|
||||
current = iterator.next();
|
||||
|
||||
if (!current.done) {
|
||||
result += ',' + config.spacingInner;
|
||||
} else if (!config.min) {
|
||||
result += ',';
|
||||
}
|
||||
}
|
||||
|
||||
result += config.spacingOuter + indentation;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
/**
|
||||
* Return items (for example, of an array)
|
||||
* with spacing, indentation, and comma
|
||||
* without surrounding punctuation (for example, brackets)
|
||||
**/
|
||||
|
||||
function printListItems(list, config, indentation, depth, refs, printer) {
|
||||
let result = '';
|
||||
|
||||
if (list.length) {
|
||||
result += config.spacingOuter;
|
||||
const indentationNext = indentation + config.indent;
|
||||
|
||||
for (let i = 0; i < list.length; i++) {
|
||||
result +=
|
||||
indentationNext +
|
||||
printer(list[i], config, indentationNext, depth, refs);
|
||||
|
||||
if (i < list.length - 1) {
|
||||
result += ',' + config.spacingInner;
|
||||
} else if (!config.min) {
|
||||
result += ',';
|
||||
}
|
||||
}
|
||||
|
||||
result += config.spacingOuter + indentation;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
/**
|
||||
* Return properties of an object
|
||||
* with spacing, indentation, and comma
|
||||
* without surrounding punctuation (for example, braces)
|
||||
*/
|
||||
|
||||
function printObjectProperties(val, config, indentation, depth, refs, printer) {
|
||||
let result = '';
|
||||
const keys = getKeysOfEnumerableProperties(val);
|
||||
|
||||
if (keys.length) {
|
||||
result += config.spacingOuter;
|
||||
const indentationNext = indentation + config.indent;
|
||||
|
||||
for (let i = 0; i < keys.length; i++) {
|
||||
const key = keys[i];
|
||||
const name = printer(key, config, indentationNext, depth, refs);
|
||||
const value = printer(val[key], config, indentationNext, depth, refs);
|
||||
result += indentationNext + name + ': ' + value;
|
||||
|
||||
if (i < keys.length - 1) {
|
||||
result += ',' + config.spacingInner;
|
||||
} else if (!config.min) {
|
||||
result += ',';
|
||||
}
|
||||
}
|
||||
|
||||
result += config.spacingOuter + indentation;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
37
node_modules/pretty-format/build/index.d.ts
generated
vendored
Normal file
37
node_modules/pretty-format/build/index.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,37 @@
|
|||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates. 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.
|
||||
*/
|
||||
import * as PrettyFormat from './types';
|
||||
/**
|
||||
* Returns a presentation string of your `val` object
|
||||
* @param val any potential JavaScript object
|
||||
* @param options Custom settings
|
||||
*/
|
||||
declare function prettyFormat(val: any, options?: PrettyFormat.OptionsReceived): string;
|
||||
declare namespace prettyFormat {
|
||||
var plugins: {
|
||||
AsymmetricMatcher: PrettyFormat.NewPlugin;
|
||||
ConvertAnsi: PrettyFormat.NewPlugin;
|
||||
DOMCollection: PrettyFormat.NewPlugin;
|
||||
DOMElement: PrettyFormat.NewPlugin;
|
||||
Immutable: PrettyFormat.NewPlugin;
|
||||
ReactElement: PrettyFormat.NewPlugin;
|
||||
ReactTestComponent: PrettyFormat.NewPlugin;
|
||||
};
|
||||
}
|
||||
declare namespace prettyFormat {
|
||||
type Colors = PrettyFormat.Colors;
|
||||
type Config = PrettyFormat.Config;
|
||||
type Options = PrettyFormat.Options;
|
||||
type OptionsReceived = PrettyFormat.OptionsReceived;
|
||||
type NewPlugin = PrettyFormat.NewPlugin;
|
||||
type Plugin = PrettyFormat.Plugin;
|
||||
type Plugins = PrettyFormat.Plugins;
|
||||
type Refs = PrettyFormat.Refs;
|
||||
type Theme = PrettyFormat.Theme;
|
||||
}
|
||||
export = prettyFormat;
|
||||
//# sourceMappingURL=index.d.ts.map
|
1
node_modules/pretty-format/build/index.d.ts.map
generated
vendored
Normal file
1
node_modules/pretty-format/build/index.d.ts.map
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,KAAK,YAAY,MAAM,SAAS,CAAC;AA8dxC;;;;GAIG;AACH,iBAAS,YAAY,CACnB,GAAG,EAAE,GAAG,EACR,OAAO,CAAC,EAAE,YAAY,CAAC,eAAe,GACrC,MAAM,CAsBR;kBAzBQ,YAAY;;;;;;;;;;;AAsCrB,kBAAU,YAAY,CAAC;IACrB,KAAY,MAAM,GAAG,YAAY,CAAC,MAAM,CAAC;IACzC,KAAY,MAAM,GAAG,YAAY,CAAC,MAAM,CAAC;IACzC,KAAY,OAAO,GAAG,YAAY,CAAC,OAAO,CAAC;IAC3C,KAAY,eAAe,GAAG,YAAY,CAAC,eAAe,CAAC;IAC3D,KAAY,SAAS,GAAG,YAAY,CAAC,SAAS,CAAC;IAC/C,KAAY,MAAM,GAAG,YAAY,CAAC,MAAM,CAAC;IACzC,KAAY,OAAO,GAAG,YAAY,CAAC,OAAO,CAAC;IAC3C,KAAY,IAAI,GAAG,YAAY,CAAC,IAAI,CAAC;IACrC,KAAY,KAAK,GAAG,YAAY,CAAC,KAAK,CAAC;CACxC;AAED,SAAS,YAAY,CAAC"}
|
556
node_modules/pretty-format/build/index.js
generated
vendored
Normal file
556
node_modules/pretty-format/build/index.js
generated
vendored
Normal file
|
@ -0,0 +1,556 @@
|
|||
'use strict';
|
||||
|
||||
var _ansiStyles = _interopRequireDefault(require('ansi-styles'));
|
||||
|
||||
var _collections = require('./collections');
|
||||
|
||||
var _AsymmetricMatcher = _interopRequireDefault(
|
||||
require('./plugins/AsymmetricMatcher')
|
||||
);
|
||||
|
||||
var _ConvertAnsi = _interopRequireDefault(require('./plugins/ConvertAnsi'));
|
||||
|
||||
var _DOMCollection = _interopRequireDefault(require('./plugins/DOMCollection'));
|
||||
|
||||
var _DOMElement = _interopRequireDefault(require('./plugins/DOMElement'));
|
||||
|
||||
var _Immutable = _interopRequireDefault(require('./plugins/Immutable'));
|
||||
|
||||
var _ReactElement = _interopRequireDefault(require('./plugins/ReactElement'));
|
||||
|
||||
var _ReactTestComponent = _interopRequireDefault(
|
||||
require('./plugins/ReactTestComponent')
|
||||
);
|
||||
|
||||
function _interopRequireDefault(obj) {
|
||||
return obj && obj.__esModule ? obj : {default: obj};
|
||||
}
|
||||
|
||||
var Symbol = global['jest-symbol-do-not-touch'] || global.Symbol;
|
||||
const toString = Object.prototype.toString;
|
||||
const toISOString = Date.prototype.toISOString;
|
||||
const errorToString = Error.prototype.toString;
|
||||
const regExpToString = RegExp.prototype.toString;
|
||||
const symbolToString = Symbol.prototype.toString;
|
||||
/**
|
||||
* Explicitly comparing typeof constructor to function avoids undefined as name
|
||||
* when mock identity-obj-proxy returns the key as the value for any key.
|
||||
*/
|
||||
|
||||
const getConstructorName = val =>
|
||||
(typeof val.constructor === 'function' && val.constructor.name) || 'Object';
|
||||
/* global window */
|
||||
|
||||
/** Is val is equal to global window object? Works even if it does not exist :) */
|
||||
|
||||
const isWindow = val => typeof window !== 'undefined' && val === window;
|
||||
|
||||
const SYMBOL_REGEXP = /^Symbol\((.*)\)(.*)$/;
|
||||
const NEWLINE_REGEXP = /\n/gi;
|
||||
|
||||
class PrettyFormatPluginError extends Error {
|
||||
constructor(message, stack) {
|
||||
super(message);
|
||||
this.stack = stack;
|
||||
this.name = this.constructor.name;
|
||||
}
|
||||
}
|
||||
|
||||
function isToStringedArrayType(toStringed) {
|
||||
return (
|
||||
toStringed === '[object Array]' ||
|
||||
toStringed === '[object ArrayBuffer]' ||
|
||||
toStringed === '[object DataView]' ||
|
||||
toStringed === '[object Float32Array]' ||
|
||||
toStringed === '[object Float64Array]' ||
|
||||
toStringed === '[object Int8Array]' ||
|
||||
toStringed === '[object Int16Array]' ||
|
||||
toStringed === '[object Int32Array]' ||
|
||||
toStringed === '[object Uint8Array]' ||
|
||||
toStringed === '[object Uint8ClampedArray]' ||
|
||||
toStringed === '[object Uint16Array]' ||
|
||||
toStringed === '[object Uint32Array]'
|
||||
);
|
||||
}
|
||||
|
||||
function printNumber(val) {
|
||||
return Object.is(val, -0) ? '-0' : String(val);
|
||||
}
|
||||
|
||||
function printBigInt(val) {
|
||||
return String(`${val}n`);
|
||||
}
|
||||
|
||||
function printFunction(val, printFunctionName) {
|
||||
if (!printFunctionName) {
|
||||
return '[Function]';
|
||||
}
|
||||
|
||||
return '[Function ' + (val.name || 'anonymous') + ']';
|
||||
}
|
||||
|
||||
function printSymbol(val) {
|
||||
return symbolToString.call(val).replace(SYMBOL_REGEXP, 'Symbol($1)');
|
||||
}
|
||||
|
||||
function printError(val) {
|
||||
return '[' + errorToString.call(val) + ']';
|
||||
}
|
||||
/**
|
||||
* The first port of call for printing an object, handles most of the
|
||||
* data-types in JS.
|
||||
*/
|
||||
|
||||
function printBasicValue(val, printFunctionName, escapeRegex, escapeString) {
|
||||
if (val === true || val === false) {
|
||||
return '' + val;
|
||||
}
|
||||
|
||||
if (val === undefined) {
|
||||
return 'undefined';
|
||||
}
|
||||
|
||||
if (val === null) {
|
||||
return 'null';
|
||||
}
|
||||
|
||||
const typeOf = typeof val;
|
||||
|
||||
if (typeOf === 'number') {
|
||||
return printNumber(val);
|
||||
}
|
||||
|
||||
if (typeOf === 'bigint') {
|
||||
return printBigInt(val);
|
||||
}
|
||||
|
||||
if (typeOf === 'string') {
|
||||
if (escapeString) {
|
||||
return '"' + val.replace(/"|\\/g, '\\$&') + '"';
|
||||
}
|
||||
|
||||
return '"' + val + '"';
|
||||
}
|
||||
|
||||
if (typeOf === 'function') {
|
||||
return printFunction(val, printFunctionName);
|
||||
}
|
||||
|
||||
if (typeOf === 'symbol') {
|
||||
return printSymbol(val);
|
||||
}
|
||||
|
||||
const toStringed = toString.call(val);
|
||||
|
||||
if (toStringed === '[object WeakMap]') {
|
||||
return 'WeakMap {}';
|
||||
}
|
||||
|
||||
if (toStringed === '[object WeakSet]') {
|
||||
return 'WeakSet {}';
|
||||
}
|
||||
|
||||
if (
|
||||
toStringed === '[object Function]' ||
|
||||
toStringed === '[object GeneratorFunction]'
|
||||
) {
|
||||
return printFunction(val, printFunctionName);
|
||||
}
|
||||
|
||||
if (toStringed === '[object Symbol]') {
|
||||
return printSymbol(val);
|
||||
}
|
||||
|
||||
if (toStringed === '[object Date]') {
|
||||
return isNaN(+val) ? 'Date { NaN }' : toISOString.call(val);
|
||||
}
|
||||
|
||||
if (toStringed === '[object Error]') {
|
||||
return printError(val);
|
||||
}
|
||||
|
||||
if (toStringed === '[object RegExp]') {
|
||||
if (escapeRegex) {
|
||||
// https://github.com/benjamingr/RegExp.escape/blob/master/polyfill.js
|
||||
return regExpToString.call(val).replace(/[\\^$*+?.()|[\]{}]/g, '\\$&');
|
||||
}
|
||||
|
||||
return regExpToString.call(val);
|
||||
}
|
||||
|
||||
if (val instanceof Error) {
|
||||
return printError(val);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
/**
|
||||
* Handles more complex objects ( such as objects with circular references.
|
||||
* maps and sets etc )
|
||||
*/
|
||||
|
||||
function printComplexValue(
|
||||
val,
|
||||
config,
|
||||
indentation,
|
||||
depth,
|
||||
refs,
|
||||
hasCalledToJSON
|
||||
) {
|
||||
if (refs.indexOf(val) !== -1) {
|
||||
return '[Circular]';
|
||||
}
|
||||
|
||||
refs = refs.slice();
|
||||
refs.push(val);
|
||||
const hitMaxDepth = ++depth > config.maxDepth;
|
||||
const min = config.min;
|
||||
|
||||
if (
|
||||
config.callToJSON &&
|
||||
!hitMaxDepth &&
|
||||
val.toJSON &&
|
||||
typeof val.toJSON === 'function' &&
|
||||
!hasCalledToJSON
|
||||
) {
|
||||
return printer(val.toJSON(), config, indentation, depth, refs, true);
|
||||
}
|
||||
|
||||
const toStringed = toString.call(val);
|
||||
|
||||
if (toStringed === '[object Arguments]') {
|
||||
return hitMaxDepth
|
||||
? '[Arguments]'
|
||||
: (min ? '' : 'Arguments ') +
|
||||
'[' +
|
||||
(0, _collections.printListItems)(
|
||||
val,
|
||||
config,
|
||||
indentation,
|
||||
depth,
|
||||
refs,
|
||||
printer
|
||||
) +
|
||||
']';
|
||||
}
|
||||
|
||||
if (isToStringedArrayType(toStringed)) {
|
||||
return hitMaxDepth
|
||||
? '[' + val.constructor.name + ']'
|
||||
: (min ? '' : val.constructor.name + ' ') +
|
||||
'[' +
|
||||
(0, _collections.printListItems)(
|
||||
val,
|
||||
config,
|
||||
indentation,
|
||||
depth,
|
||||
refs,
|
||||
printer
|
||||
) +
|
||||
']';
|
||||
}
|
||||
|
||||
if (toStringed === '[object Map]') {
|
||||
return hitMaxDepth
|
||||
? '[Map]'
|
||||
: 'Map {' +
|
||||
(0, _collections.printIteratorEntries)(
|
||||
val.entries(),
|
||||
config,
|
||||
indentation,
|
||||
depth,
|
||||
refs,
|
||||
printer,
|
||||
' => '
|
||||
) +
|
||||
'}';
|
||||
}
|
||||
|
||||
if (toStringed === '[object Set]') {
|
||||
return hitMaxDepth
|
||||
? '[Set]'
|
||||
: 'Set {' +
|
||||
(0, _collections.printIteratorValues)(
|
||||
val.values(),
|
||||
config,
|
||||
indentation,
|
||||
depth,
|
||||
refs,
|
||||
printer
|
||||
) +
|
||||
'}';
|
||||
} // Avoid failure to serialize global window object in jsdom test environment.
|
||||
// For example, not even relevant if window is prop of React element.
|
||||
|
||||
return hitMaxDepth || isWindow(val)
|
||||
? '[' + getConstructorName(val) + ']'
|
||||
: (min ? '' : getConstructorName(val) + ' ') +
|
||||
'{' +
|
||||
(0, _collections.printObjectProperties)(
|
||||
val,
|
||||
config,
|
||||
indentation,
|
||||
depth,
|
||||
refs,
|
||||
printer
|
||||
) +
|
||||
'}';
|
||||
}
|
||||
|
||||
function isNewPlugin(plugin) {
|
||||
return plugin.serialize != null;
|
||||
}
|
||||
|
||||
function printPlugin(plugin, val, config, indentation, depth, refs) {
|
||||
let printed;
|
||||
|
||||
try {
|
||||
printed = isNewPlugin(plugin)
|
||||
? plugin.serialize(val, config, indentation, depth, refs, printer)
|
||||
: plugin.print(
|
||||
val,
|
||||
valChild => printer(valChild, config, indentation, depth, refs),
|
||||
str => {
|
||||
const indentationNext = indentation + config.indent;
|
||||
return (
|
||||
indentationNext +
|
||||
str.replace(NEWLINE_REGEXP, '\n' + indentationNext)
|
||||
);
|
||||
},
|
||||
{
|
||||
edgeSpacing: config.spacingOuter,
|
||||
min: config.min,
|
||||
spacing: config.spacingInner
|
||||
},
|
||||
config.colors
|
||||
);
|
||||
} catch (error) {
|
||||
throw new PrettyFormatPluginError(error.message, error.stack);
|
||||
}
|
||||
|
||||
if (typeof printed !== 'string') {
|
||||
throw new Error(
|
||||
`pretty-format: Plugin must return type "string" but instead returned "${typeof printed}".`
|
||||
);
|
||||
}
|
||||
|
||||
return printed;
|
||||
}
|
||||
|
||||
function findPlugin(plugins, val) {
|
||||
for (let p = 0; p < plugins.length; p++) {
|
||||
try {
|
||||
if (plugins[p].test(val)) {
|
||||
return plugins[p];
|
||||
}
|
||||
} catch (error) {
|
||||
throw new PrettyFormatPluginError(error.message, error.stack);
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
function printer(val, config, indentation, depth, refs, hasCalledToJSON) {
|
||||
const plugin = findPlugin(config.plugins, val);
|
||||
|
||||
if (plugin !== null) {
|
||||
return printPlugin(plugin, val, config, indentation, depth, refs);
|
||||
}
|
||||
|
||||
const basicResult = printBasicValue(
|
||||
val,
|
||||
config.printFunctionName,
|
||||
config.escapeRegex,
|
||||
config.escapeString
|
||||
);
|
||||
|
||||
if (basicResult !== null) {
|
||||
return basicResult;
|
||||
}
|
||||
|
||||
return printComplexValue(
|
||||
val,
|
||||
config,
|
||||
indentation,
|
||||
depth,
|
||||
refs,
|
||||
hasCalledToJSON
|
||||
);
|
||||
}
|
||||
|
||||
const DEFAULT_THEME = {
|
||||
comment: 'gray',
|
||||
content: 'reset',
|
||||
prop: 'yellow',
|
||||
tag: 'cyan',
|
||||
value: 'green'
|
||||
};
|
||||
const DEFAULT_THEME_KEYS = Object.keys(DEFAULT_THEME);
|
||||
const DEFAULT_OPTIONS = {
|
||||
callToJSON: true,
|
||||
escapeRegex: false,
|
||||
escapeString: true,
|
||||
highlight: false,
|
||||
indent: 2,
|
||||
maxDepth: Infinity,
|
||||
min: false,
|
||||
plugins: [],
|
||||
printFunctionName: true,
|
||||
theme: DEFAULT_THEME
|
||||
};
|
||||
|
||||
function validateOptions(options) {
|
||||
Object.keys(options).forEach(key => {
|
||||
if (!DEFAULT_OPTIONS.hasOwnProperty(key)) {
|
||||
throw new Error(`pretty-format: Unknown option "${key}".`);
|
||||
}
|
||||
});
|
||||
|
||||
if (options.min && options.indent !== undefined && options.indent !== 0) {
|
||||
throw new Error(
|
||||
'pretty-format: Options "min" and "indent" cannot be used together.'
|
||||
);
|
||||
}
|
||||
|
||||
if (options.theme !== undefined) {
|
||||
if (options.theme === null) {
|
||||
throw new Error(`pretty-format: Option "theme" must not be null.`);
|
||||
}
|
||||
|
||||
if (typeof options.theme !== 'object') {
|
||||
throw new Error(
|
||||
`pretty-format: Option "theme" must be of type "object" but instead received "${typeof options.theme}".`
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const getColorsHighlight = options =>
|
||||
DEFAULT_THEME_KEYS.reduce((colors, key) => {
|
||||
const value =
|
||||
options.theme && options.theme[key] !== undefined
|
||||
? options.theme[key]
|
||||
: DEFAULT_THEME[key];
|
||||
const color = _ansiStyles.default[value];
|
||||
|
||||
if (
|
||||
color &&
|
||||
typeof color.close === 'string' &&
|
||||
typeof color.open === 'string'
|
||||
) {
|
||||
colors[key] = color;
|
||||
} else {
|
||||
throw new Error(
|
||||
`pretty-format: Option "theme" has a key "${key}" whose value "${value}" is undefined in ansi-styles.`
|
||||
);
|
||||
}
|
||||
|
||||
return colors;
|
||||
}, Object.create(null));
|
||||
|
||||
const getColorsEmpty = () =>
|
||||
DEFAULT_THEME_KEYS.reduce((colors, key) => {
|
||||
colors[key] = {
|
||||
close: '',
|
||||
open: ''
|
||||
};
|
||||
return colors;
|
||||
}, Object.create(null));
|
||||
|
||||
const getPrintFunctionName = options =>
|
||||
options && options.printFunctionName !== undefined
|
||||
? options.printFunctionName
|
||||
: DEFAULT_OPTIONS.printFunctionName;
|
||||
|
||||
const getEscapeRegex = options =>
|
||||
options && options.escapeRegex !== undefined
|
||||
? options.escapeRegex
|
||||
: DEFAULT_OPTIONS.escapeRegex;
|
||||
|
||||
const getEscapeString = options =>
|
||||
options && options.escapeString !== undefined
|
||||
? options.escapeString
|
||||
: DEFAULT_OPTIONS.escapeString;
|
||||
|
||||
const getConfig = options => ({
|
||||
callToJSON:
|
||||
options && options.callToJSON !== undefined
|
||||
? options.callToJSON
|
||||
: DEFAULT_OPTIONS.callToJSON,
|
||||
colors:
|
||||
options && options.highlight
|
||||
? getColorsHighlight(options)
|
||||
: getColorsEmpty(),
|
||||
escapeRegex: getEscapeRegex(options),
|
||||
escapeString: getEscapeString(options),
|
||||
indent:
|
||||
options && options.min
|
||||
? ''
|
||||
: createIndent(
|
||||
options && options.indent !== undefined
|
||||
? options.indent
|
||||
: DEFAULT_OPTIONS.indent
|
||||
),
|
||||
maxDepth:
|
||||
options && options.maxDepth !== undefined
|
||||
? options.maxDepth
|
||||
: DEFAULT_OPTIONS.maxDepth,
|
||||
min: options && options.min !== undefined ? options.min : DEFAULT_OPTIONS.min,
|
||||
plugins:
|
||||
options && options.plugins !== undefined
|
||||
? options.plugins
|
||||
: DEFAULT_OPTIONS.plugins,
|
||||
printFunctionName: getPrintFunctionName(options),
|
||||
spacingInner: options && options.min ? ' ' : '\n',
|
||||
spacingOuter: options && options.min ? '' : '\n'
|
||||
});
|
||||
|
||||
function createIndent(indent) {
|
||||
return new Array(indent + 1).join(' ');
|
||||
}
|
||||
/**
|
||||
* Returns a presentation string of your `val` object
|
||||
* @param val any potential JavaScript object
|
||||
* @param options Custom settings
|
||||
*/
|
||||
|
||||
function prettyFormat(val, options) {
|
||||
if (options) {
|
||||
validateOptions(options);
|
||||
|
||||
if (options.plugins) {
|
||||
const plugin = findPlugin(options.plugins, val);
|
||||
|
||||
if (plugin !== null) {
|
||||
return printPlugin(plugin, val, getConfig(options), '', 0, []);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const basicResult = printBasicValue(
|
||||
val,
|
||||
getPrintFunctionName(options),
|
||||
getEscapeRegex(options),
|
||||
getEscapeString(options)
|
||||
);
|
||||
|
||||
if (basicResult !== null) {
|
||||
return basicResult;
|
||||
}
|
||||
|
||||
return printComplexValue(val, getConfig(options), '', 0, []);
|
||||
}
|
||||
|
||||
prettyFormat.plugins = {
|
||||
AsymmetricMatcher: _AsymmetricMatcher.default,
|
||||
ConvertAnsi: _ConvertAnsi.default,
|
||||
DOMCollection: _DOMCollection.default,
|
||||
DOMElement: _DOMElement.default,
|
||||
Immutable: _Immutable.default,
|
||||
ReactElement: _ReactElement.default,
|
||||
ReactTestComponent: _ReactTestComponent.default
|
||||
};
|
||||
/* eslint-disable-next-line no-redeclare */
|
||||
|
||||
module.exports = prettyFormat;
|
12
node_modules/pretty-format/build/plugins/AsymmetricMatcher.d.ts
generated
vendored
Normal file
12
node_modules/pretty-format/build/plugins/AsymmetricMatcher.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,12 @@
|
|||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates. 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.
|
||||
*/
|
||||
import { Config, NewPlugin, Printer } from '../types';
|
||||
export declare const serialize: (val: any, config: Config, indentation: string, depth: number, refs: any[], printer: Printer) => string;
|
||||
export declare const test: (val: any) => boolean;
|
||||
declare const plugin: NewPlugin;
|
||||
export default plugin;
|
||||
//# sourceMappingURL=AsymmetricMatcher.d.ts.map
|
1
node_modules/pretty-format/build/plugins/AsymmetricMatcher.d.ts.map
generated
vendored
Normal file
1
node_modules/pretty-format/build/plugins/AsymmetricMatcher.d.ts.map
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"AsymmetricMatcher.d.ts","sourceRoot":"","sources":["../../src/plugins/AsymmetricMatcher.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAC,MAAM,EAAE,SAAS,EAAE,OAAO,EAAO,MAAM,UAAU,CAAC;AAO1D,eAAO,MAAM,SAAS,yGAwErB,CAAC;AAEF,eAAO,MAAM,IAAI,uBAA0D,CAAC;AAE5E,QAAA,MAAM,MAAM,EAAE,SAA6B,CAAC;AAE5C,eAAe,MAAM,CAAC"}
|
100
node_modules/pretty-format/build/plugins/AsymmetricMatcher.js
generated
vendored
Normal file
100
node_modules/pretty-format/build/plugins/AsymmetricMatcher.js
generated
vendored
Normal file
|
@ -0,0 +1,100 @@
|
|||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', {
|
||||
value: true
|
||||
});
|
||||
exports.default = exports.test = exports.serialize = void 0;
|
||||
|
||||
var _collections = require('../collections');
|
||||
|
||||
var Symbol = global['jest-symbol-do-not-touch'] || global.Symbol;
|
||||
const asymmetricMatcher = Symbol.for('jest.asymmetricMatcher');
|
||||
const SPACE = ' ';
|
||||
|
||||
const serialize = (val, config, indentation, depth, refs, printer) => {
|
||||
const stringedValue = val.toString();
|
||||
|
||||
if (
|
||||
stringedValue === 'ArrayContaining' ||
|
||||
stringedValue === 'ArrayNotContaining'
|
||||
) {
|
||||
if (++depth > config.maxDepth) {
|
||||
return '[' + stringedValue + ']';
|
||||
}
|
||||
|
||||
return (
|
||||
stringedValue +
|
||||
SPACE +
|
||||
'[' +
|
||||
(0, _collections.printListItems)(
|
||||
val.sample,
|
||||
config,
|
||||
indentation,
|
||||
depth,
|
||||
refs,
|
||||
printer
|
||||
) +
|
||||
']'
|
||||
);
|
||||
}
|
||||
|
||||
if (
|
||||
stringedValue === 'ObjectContaining' ||
|
||||
stringedValue === 'ObjectNotContaining'
|
||||
) {
|
||||
if (++depth > config.maxDepth) {
|
||||
return '[' + stringedValue + ']';
|
||||
}
|
||||
|
||||
return (
|
||||
stringedValue +
|
||||
SPACE +
|
||||
'{' +
|
||||
(0, _collections.printObjectProperties)(
|
||||
val.sample,
|
||||
config,
|
||||
indentation,
|
||||
depth,
|
||||
refs,
|
||||
printer
|
||||
) +
|
||||
'}'
|
||||
);
|
||||
}
|
||||
|
||||
if (
|
||||
stringedValue === 'StringMatching' ||
|
||||
stringedValue === 'StringNotMatching'
|
||||
) {
|
||||
return (
|
||||
stringedValue +
|
||||
SPACE +
|
||||
printer(val.sample, config, indentation, depth, refs)
|
||||
);
|
||||
}
|
||||
|
||||
if (
|
||||
stringedValue === 'StringContaining' ||
|
||||
stringedValue === 'StringNotContaining'
|
||||
) {
|
||||
return (
|
||||
stringedValue +
|
||||
SPACE +
|
||||
printer(val.sample, config, indentation, depth, refs)
|
||||
);
|
||||
}
|
||||
|
||||
return val.toAsymmetricMatcher();
|
||||
};
|
||||
|
||||
exports.serialize = serialize;
|
||||
|
||||
const test = val => val && val.$$typeof === asymmetricMatcher;
|
||||
|
||||
exports.test = test;
|
||||
const plugin = {
|
||||
serialize,
|
||||
test
|
||||
};
|
||||
var _default = plugin;
|
||||
exports.default = _default;
|
12
node_modules/pretty-format/build/plugins/ConvertAnsi.d.ts
generated
vendored
Normal file
12
node_modules/pretty-format/build/plugins/ConvertAnsi.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,12 @@
|
|||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates. 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.
|
||||
*/
|
||||
import { Config, Printer, NewPlugin } from '../types';
|
||||
export declare const test: (val: any) => boolean;
|
||||
export declare const serialize: (val: string, config: Config, indentation: string, depth: number, refs: any[], printer: Printer) => string;
|
||||
declare const plugin: NewPlugin;
|
||||
export default plugin;
|
||||
//# sourceMappingURL=ConvertAnsi.d.ts.map
|
1
node_modules/pretty-format/build/plugins/ConvertAnsi.d.ts.map
generated
vendored
Normal file
1
node_modules/pretty-format/build/plugins/ConvertAnsi.d.ts.map
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"ConvertAnsi.d.ts","sourceRoot":"","sources":["../../src/plugins/ConvertAnsi.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,EAAC,MAAM,EAAE,OAAO,EAAE,SAAS,EAAO,MAAM,UAAU,CAAC;AAiD1D,eAAO,MAAM,IAAI,uBACoC,CAAC;AAEtD,eAAO,MAAM,SAAS,4GAOkD,CAAC;AAEzE,QAAA,MAAM,MAAM,EAAE,SAA6B,CAAC;AAE5C,eAAe,MAAM,CAAC"}
|
96
node_modules/pretty-format/build/plugins/ConvertAnsi.js
generated
vendored
Normal file
96
node_modules/pretty-format/build/plugins/ConvertAnsi.js
generated
vendored
Normal file
|
@ -0,0 +1,96 @@
|
|||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', {
|
||||
value: true
|
||||
});
|
||||
exports.default = exports.serialize = exports.test = void 0;
|
||||
|
||||
var _ansiRegex = _interopRequireDefault(require('ansi-regex'));
|
||||
|
||||
var _ansiStyles = _interopRequireDefault(require('ansi-styles'));
|
||||
|
||||
function _interopRequireDefault(obj) {
|
||||
return obj && obj.__esModule ? obj : {default: obj};
|
||||
}
|
||||
|
||||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates. 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 toHumanReadableAnsi = text =>
|
||||
text.replace((0, _ansiRegex.default)(), match => {
|
||||
switch (match) {
|
||||
case _ansiStyles.default.red.close:
|
||||
case _ansiStyles.default.green.close:
|
||||
case _ansiStyles.default.cyan.close:
|
||||
case _ansiStyles.default.gray.close:
|
||||
case _ansiStyles.default.white.close:
|
||||
case _ansiStyles.default.yellow.close:
|
||||
case _ansiStyles.default.bgRed.close:
|
||||
case _ansiStyles.default.bgGreen.close:
|
||||
case _ansiStyles.default.bgYellow.close:
|
||||
case _ansiStyles.default.inverse.close:
|
||||
case _ansiStyles.default.dim.close:
|
||||
case _ansiStyles.default.bold.close:
|
||||
case _ansiStyles.default.reset.open:
|
||||
case _ansiStyles.default.reset.close:
|
||||
return '</>';
|
||||
|
||||
case _ansiStyles.default.red.open:
|
||||
return '<red>';
|
||||
|
||||
case _ansiStyles.default.green.open:
|
||||
return '<green>';
|
||||
|
||||
case _ansiStyles.default.cyan.open:
|
||||
return '<cyan>';
|
||||
|
||||
case _ansiStyles.default.gray.open:
|
||||
return '<gray>';
|
||||
|
||||
case _ansiStyles.default.white.open:
|
||||
return '<white>';
|
||||
|
||||
case _ansiStyles.default.yellow.open:
|
||||
return '<yellow>';
|
||||
|
||||
case _ansiStyles.default.bgRed.open:
|
||||
return '<bgRed>';
|
||||
|
||||
case _ansiStyles.default.bgGreen.open:
|
||||
return '<bgGreen>';
|
||||
|
||||
case _ansiStyles.default.bgYellow.open:
|
||||
return '<bgYellow>';
|
||||
|
||||
case _ansiStyles.default.inverse.open:
|
||||
return '<inverse>';
|
||||
|
||||
case _ansiStyles.default.dim.open:
|
||||
return '<dim>';
|
||||
|
||||
case _ansiStyles.default.bold.open:
|
||||
return '<bold>';
|
||||
|
||||
default:
|
||||
return '';
|
||||
}
|
||||
});
|
||||
|
||||
const test = val =>
|
||||
typeof val === 'string' && !!val.match((0, _ansiRegex.default)());
|
||||
|
||||
exports.test = test;
|
||||
|
||||
const serialize = (val, config, indentation, depth, refs, printer) =>
|
||||
printer(toHumanReadableAnsi(val), config, indentation, depth, refs);
|
||||
|
||||
exports.serialize = serialize;
|
||||
const plugin = {
|
||||
serialize,
|
||||
test
|
||||
};
|
||||
var _default = plugin;
|
||||
exports.default = _default;
|
12
node_modules/pretty-format/build/plugins/DOMCollection.d.ts
generated
vendored
Normal file
12
node_modules/pretty-format/build/plugins/DOMCollection.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,12 @@
|
|||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates. 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.
|
||||
*/
|
||||
import { Config, NewPlugin, Printer } from '../types';
|
||||
export declare const test: (val: any) => boolean;
|
||||
export declare const serialize: (collection: any, config: Config, indentation: string, depth: number, refs: any[], printer: Printer) => string;
|
||||
declare const plugin: NewPlugin;
|
||||
export default plugin;
|
||||
//# sourceMappingURL=DOMCollection.d.ts.map
|
1
node_modules/pretty-format/build/plugins/DOMCollection.d.ts.map
generated
vendored
Normal file
1
node_modules/pretty-format/build/plugins/DOMCollection.d.ts.map
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"DOMCollection.d.ts","sourceRoot":"","sources":["../../src/plugins/DOMCollection.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAC,MAAM,EAAE,SAAS,EAAE,OAAO,EAAO,MAAM,UAAU,CAAC;AAY1D,eAAO,MAAM,IAAI,uBAIe,CAAC;AAQjC,eAAO,MAAM,SAAS,gHAuCrB,CAAC;AAEF,QAAA,MAAM,MAAM,EAAE,SAA6B,CAAC;AAE5C,eAAe,MAAM,CAAC"}
|
103
node_modules/pretty-format/build/plugins/DOMCollection.js
generated
vendored
Normal file
103
node_modules/pretty-format/build/plugins/DOMCollection.js
generated
vendored
Normal file
|
@ -0,0 +1,103 @@
|
|||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', {
|
||||
value: true
|
||||
});
|
||||
exports.default = exports.serialize = exports.test = void 0;
|
||||
|
||||
var _collections = require('../collections');
|
||||
|
||||
function _objectSpread(target) {
|
||||
for (var i = 1; i < arguments.length; i++) {
|
||||
var source = arguments[i] != null ? arguments[i] : {};
|
||||
var ownKeys = Object.keys(source);
|
||||
if (typeof Object.getOwnPropertySymbols === 'function') {
|
||||
ownKeys = ownKeys.concat(
|
||||
Object.getOwnPropertySymbols(source).filter(function(sym) {
|
||||
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
||||
})
|
||||
);
|
||||
}
|
||||
ownKeys.forEach(function(key) {
|
||||
_defineProperty(target, key, source[key]);
|
||||
});
|
||||
}
|
||||
return target;
|
||||
}
|
||||
|
||||
function _defineProperty(obj, key, value) {
|
||||
if (key in obj) {
|
||||
Object.defineProperty(obj, key, {
|
||||
value: value,
|
||||
enumerable: true,
|
||||
configurable: true,
|
||||
writable: true
|
||||
});
|
||||
} else {
|
||||
obj[key] = value;
|
||||
}
|
||||
return obj;
|
||||
}
|
||||
|
||||
const SPACE = ' ';
|
||||
const OBJECT_NAMES = ['DOMStringMap', 'NamedNodeMap'];
|
||||
const ARRAY_REGEXP = /^(HTML\w*Collection|NodeList)$/;
|
||||
|
||||
const testName = name =>
|
||||
OBJECT_NAMES.indexOf(name) !== -1 || ARRAY_REGEXP.test(name);
|
||||
|
||||
const test = val =>
|
||||
val &&
|
||||
val.constructor &&
|
||||
val.constructor.name &&
|
||||
testName(val.constructor.name); // Convert array of attribute objects to props object.
|
||||
|
||||
exports.test = test;
|
||||
|
||||
const propsReducer = (props, attribute) => {
|
||||
props[attribute.name] = attribute.value;
|
||||
return props;
|
||||
};
|
||||
|
||||
const serialize = (collection, config, indentation, depth, refs, printer) => {
|
||||
const name = collection.constructor.name;
|
||||
|
||||
if (++depth > config.maxDepth) {
|
||||
return '[' + name + ']';
|
||||
}
|
||||
|
||||
return (
|
||||
(config.min ? '' : name + SPACE) +
|
||||
(OBJECT_NAMES.indexOf(name) !== -1
|
||||
? '{' +
|
||||
(0, _collections.printObjectProperties)(
|
||||
name === 'NamedNodeMap'
|
||||
? Array.prototype.reduce.call(collection, propsReducer, {})
|
||||
: _objectSpread({}, collection),
|
||||
config,
|
||||
indentation,
|
||||
depth,
|
||||
refs,
|
||||
printer
|
||||
) +
|
||||
'}'
|
||||
: '[' +
|
||||
(0, _collections.printListItems)(
|
||||
Array.from(collection),
|
||||
config,
|
||||
indentation,
|
||||
depth,
|
||||
refs,
|
||||
printer
|
||||
) +
|
||||
']')
|
||||
);
|
||||
};
|
||||
|
||||
exports.serialize = serialize;
|
||||
const plugin = {
|
||||
serialize,
|
||||
test
|
||||
};
|
||||
var _default = plugin;
|
||||
exports.default = _default;
|
13
node_modules/pretty-format/build/plugins/DOMElement.d.ts
generated
vendored
Normal file
13
node_modules/pretty-format/build/plugins/DOMElement.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,13 @@
|
|||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates. 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.
|
||||
*/
|
||||
import { Config, NewPlugin, Printer } from '../types';
|
||||
export declare const test: (val: any) => boolean;
|
||||
declare type HandledType = Element | Text | Comment | DocumentFragment;
|
||||
export declare const serialize: (node: HandledType, config: Config, indentation: string, depth: number, refs: any[], printer: Printer) => string;
|
||||
declare const plugin: NewPlugin;
|
||||
export default plugin;
|
||||
//# sourceMappingURL=DOMElement.d.ts.map
|
1
node_modules/pretty-format/build/plugins/DOMElement.d.ts.map
generated
vendored
Normal file
1
node_modules/pretty-format/build/plugins/DOMElement.d.ts.map
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"DOMElement.d.ts","sourceRoot":"","sources":["../../src/plugins/DOMElement.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAC,MAAM,EAAE,SAAS,EAAE,OAAO,EAAO,MAAM,UAAU,CAAC;AAwB1D,eAAO,MAAM,IAAI,uBAI6B,CAAC;AAE/C,aAAK,WAAW,GAAG,OAAO,GAAG,IAAI,GAAG,OAAO,GAAG,gBAAgB,CAAC;AAc/D,eAAO,MAAM,SAAS,kHA0DrB,CAAC;AAEF,QAAA,MAAM,MAAM,EAAE,SAA6B,CAAC;AAE5C,eAAe,MAAM,CAAC"}
|
104
node_modules/pretty-format/build/plugins/DOMElement.js
generated
vendored
Normal file
104
node_modules/pretty-format/build/plugins/DOMElement.js
generated
vendored
Normal file
|
@ -0,0 +1,104 @@
|
|||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', {
|
||||
value: true
|
||||
});
|
||||
exports.default = exports.serialize = exports.test = void 0;
|
||||
|
||||
var _markup = require('./lib/markup');
|
||||
|
||||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates. 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 ELEMENT_NODE = 1;
|
||||
const TEXT_NODE = 3;
|
||||
const COMMENT_NODE = 8;
|
||||
const FRAGMENT_NODE = 11;
|
||||
const ELEMENT_REGEXP = /^((HTML|SVG)\w*)?Element$/;
|
||||
|
||||
const testNode = (nodeType, name) =>
|
||||
(nodeType === ELEMENT_NODE && ELEMENT_REGEXP.test(name)) ||
|
||||
(nodeType === TEXT_NODE && name === 'Text') ||
|
||||
(nodeType === COMMENT_NODE && name === 'Comment') ||
|
||||
(nodeType === FRAGMENT_NODE && name === 'DocumentFragment');
|
||||
|
||||
const test = val =>
|
||||
val &&
|
||||
val.constructor &&
|
||||
val.constructor.name &&
|
||||
testNode(val.nodeType, val.constructor.name);
|
||||
|
||||
exports.test = test;
|
||||
|
||||
function nodeIsText(node) {
|
||||
return node.nodeType === TEXT_NODE;
|
||||
}
|
||||
|
||||
function nodeIsComment(node) {
|
||||
return node.nodeType === COMMENT_NODE;
|
||||
}
|
||||
|
||||
function nodeIsFragment(node) {
|
||||
return node.nodeType === FRAGMENT_NODE;
|
||||
}
|
||||
|
||||
const serialize = (node, config, indentation, depth, refs, printer) => {
|
||||
if (nodeIsText(node)) {
|
||||
return (0, _markup.printText)(node.data, config);
|
||||
}
|
||||
|
||||
if (nodeIsComment(node)) {
|
||||
return (0, _markup.printComment)(node.data, config);
|
||||
}
|
||||
|
||||
const type = nodeIsFragment(node)
|
||||
? `DocumentFragment`
|
||||
: node.tagName.toLowerCase();
|
||||
|
||||
if (++depth > config.maxDepth) {
|
||||
return (0, _markup.printElementAsLeaf)(type, config);
|
||||
}
|
||||
|
||||
return (0, _markup.printElement)(
|
||||
type,
|
||||
(0, _markup.printProps)(
|
||||
nodeIsFragment(node)
|
||||
? []
|
||||
: Array.from(node.attributes)
|
||||
.map(attr => attr.name)
|
||||
.sort(),
|
||||
nodeIsFragment(node)
|
||||
? []
|
||||
: Array.from(node.attributes).reduce((props, attribute) => {
|
||||
props[attribute.name] = attribute.value;
|
||||
return props;
|
||||
}, {}),
|
||||
config,
|
||||
indentation + config.indent,
|
||||
depth,
|
||||
refs,
|
||||
printer
|
||||
),
|
||||
(0, _markup.printChildren)(
|
||||
Array.prototype.slice.call(node.childNodes || node.children),
|
||||
config,
|
||||
indentation + config.indent,
|
||||
depth,
|
||||
refs,
|
||||
printer
|
||||
),
|
||||
config,
|
||||
indentation
|
||||
);
|
||||
};
|
||||
|
||||
exports.serialize = serialize;
|
||||
const plugin = {
|
||||
serialize,
|
||||
test
|
||||
};
|
||||
var _default = plugin;
|
||||
exports.default = _default;
|
12
node_modules/pretty-format/build/plugins/Immutable.d.ts
generated
vendored
Normal file
12
node_modules/pretty-format/build/plugins/Immutable.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,12 @@
|
|||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates. 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.
|
||||
*/
|
||||
import { Config, Printer, NewPlugin } from '../types';
|
||||
export declare const serialize: (val: any, config: Config, indentation: string, depth: number, refs: any[], printer: Printer) => string;
|
||||
export declare const test: (val: any) => boolean;
|
||||
declare const plugin: NewPlugin;
|
||||
export default plugin;
|
||||
//# sourceMappingURL=Immutable.d.ts.map
|
1
node_modules/pretty-format/build/plugins/Immutable.d.ts.map
generated
vendored
Normal file
1
node_modules/pretty-format/build/plugins/Immutable.d.ts.map
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"Immutable.d.ts","sourceRoot":"","sources":["../../src/plugins/Immutable.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAC,MAAM,EAAE,OAAO,EAAE,SAAS,EAAO,MAAM,UAAU,CAAC;AAoK1D,eAAO,MAAM,SAAS,yGA4DrB,CAAC;AAIF,eAAO,MAAM,IAAI,uBAEyD,CAAC;AAE3E,QAAA,MAAM,MAAM,EAAE,SAA6B,CAAC;AAE5C,eAAe,MAAM,CAAC"}
|
246
node_modules/pretty-format/build/plugins/Immutable.js
generated
vendored
Normal file
246
node_modules/pretty-format/build/plugins/Immutable.js
generated
vendored
Normal file
|
@ -0,0 +1,246 @@
|
|||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', {
|
||||
value: true
|
||||
});
|
||||
exports.default = exports.test = exports.serialize = void 0;
|
||||
|
||||
var _collections = require('../collections');
|
||||
|
||||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates. 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.
|
||||
*/
|
||||
// SENTINEL constants are from https://github.com/facebook/immutable-js
|
||||
const IS_ITERABLE_SENTINEL = '@@__IMMUTABLE_ITERABLE__@@';
|
||||
const IS_LIST_SENTINEL = '@@__IMMUTABLE_LIST__@@';
|
||||
const IS_KEYED_SENTINEL = '@@__IMMUTABLE_KEYED__@@';
|
||||
const IS_MAP_SENTINEL = '@@__IMMUTABLE_MAP__@@';
|
||||
const IS_ORDERED_SENTINEL = '@@__IMMUTABLE_ORDERED__@@';
|
||||
const IS_RECORD_SENTINEL = '@@__IMMUTABLE_RECORD__@@'; // immutable v4
|
||||
|
||||
const IS_SEQ_SENTINEL = '@@__IMMUTABLE_SEQ__@@';
|
||||
const IS_SET_SENTINEL = '@@__IMMUTABLE_SET__@@';
|
||||
const IS_STACK_SENTINEL = '@@__IMMUTABLE_STACK__@@';
|
||||
|
||||
const getImmutableName = name => 'Immutable.' + name;
|
||||
|
||||
const printAsLeaf = name => '[' + name + ']';
|
||||
|
||||
const SPACE = ' ';
|
||||
const LAZY = '…'; // Seq is lazy if it calls a method like filter
|
||||
|
||||
const printImmutableEntries = (
|
||||
val,
|
||||
config,
|
||||
indentation,
|
||||
depth,
|
||||
refs,
|
||||
printer,
|
||||
type
|
||||
) =>
|
||||
++depth > config.maxDepth
|
||||
? printAsLeaf(getImmutableName(type))
|
||||
: getImmutableName(type) +
|
||||
SPACE +
|
||||
'{' +
|
||||
(0, _collections.printIteratorEntries)(
|
||||
val.entries(),
|
||||
config,
|
||||
indentation,
|
||||
depth,
|
||||
refs,
|
||||
printer
|
||||
) +
|
||||
'}'; // Record has an entries method because it is a collection in immutable v3.
|
||||
// Return an iterator for Immutable Record from version v3 or v4.
|
||||
|
||||
const getRecordEntries = val => {
|
||||
let i = 0;
|
||||
return {
|
||||
next() {
|
||||
if (i < val._keys.length) {
|
||||
const key = val._keys[i++];
|
||||
return {
|
||||
done: false,
|
||||
value: [key, val.get(key)]
|
||||
};
|
||||
}
|
||||
|
||||
return {
|
||||
done: true
|
||||
};
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
const printImmutableRecord = (
|
||||
val,
|
||||
config,
|
||||
indentation,
|
||||
depth,
|
||||
refs,
|
||||
printer
|
||||
) => {
|
||||
// _name property is defined only for an Immutable Record instance
|
||||
// which was constructed with a second optional descriptive name arg
|
||||
const name = getImmutableName(val._name || 'Record');
|
||||
return ++depth > config.maxDepth
|
||||
? printAsLeaf(name)
|
||||
: name +
|
||||
SPACE +
|
||||
'{' +
|
||||
(0, _collections.printIteratorEntries)(
|
||||
getRecordEntries(val),
|
||||
config,
|
||||
indentation,
|
||||
depth,
|
||||
refs,
|
||||
printer
|
||||
) +
|
||||
'}';
|
||||
};
|
||||
|
||||
const printImmutableSeq = (val, config, indentation, depth, refs, printer) => {
|
||||
const name = getImmutableName('Seq');
|
||||
|
||||
if (++depth > config.maxDepth) {
|
||||
return printAsLeaf(name);
|
||||
}
|
||||
|
||||
if (val[IS_KEYED_SENTINEL]) {
|
||||
return (
|
||||
name +
|
||||
SPACE +
|
||||
'{' + // from Immutable collection of entries or from ECMAScript object
|
||||
(val._iter || val._object
|
||||
? (0, _collections.printIteratorEntries)(
|
||||
val.entries(),
|
||||
config,
|
||||
indentation,
|
||||
depth,
|
||||
refs,
|
||||
printer
|
||||
)
|
||||
: LAZY) +
|
||||
'}'
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
name +
|
||||
SPACE +
|
||||
'[' +
|
||||
(val._iter || // from Immutable collection of values
|
||||
val._array || // from ECMAScript array
|
||||
val._collection || // from ECMAScript collection in immutable v4
|
||||
val._iterable // from ECMAScript collection in immutable v3
|
||||
? (0, _collections.printIteratorValues)(
|
||||
val.values(),
|
||||
config,
|
||||
indentation,
|
||||
depth,
|
||||
refs,
|
||||
printer
|
||||
)
|
||||
: LAZY) +
|
||||
']'
|
||||
);
|
||||
};
|
||||
|
||||
const printImmutableValues = (
|
||||
val,
|
||||
config,
|
||||
indentation,
|
||||
depth,
|
||||
refs,
|
||||
printer,
|
||||
type
|
||||
) =>
|
||||
++depth > config.maxDepth
|
||||
? printAsLeaf(getImmutableName(type))
|
||||
: getImmutableName(type) +
|
||||
SPACE +
|
||||
'[' +
|
||||
(0, _collections.printIteratorValues)(
|
||||
val.values(),
|
||||
config,
|
||||
indentation,
|
||||
depth,
|
||||
refs,
|
||||
printer
|
||||
) +
|
||||
']';
|
||||
|
||||
const serialize = (val, config, indentation, depth, refs, printer) => {
|
||||
if (val[IS_MAP_SENTINEL]) {
|
||||
return printImmutableEntries(
|
||||
val,
|
||||
config,
|
||||
indentation,
|
||||
depth,
|
||||
refs,
|
||||
printer,
|
||||
val[IS_ORDERED_SENTINEL] ? 'OrderedMap' : 'Map'
|
||||
);
|
||||
}
|
||||
|
||||
if (val[IS_LIST_SENTINEL]) {
|
||||
return printImmutableValues(
|
||||
val,
|
||||
config,
|
||||
indentation,
|
||||
depth,
|
||||
refs,
|
||||
printer,
|
||||
'List'
|
||||
);
|
||||
}
|
||||
|
||||
if (val[IS_SET_SENTINEL]) {
|
||||
return printImmutableValues(
|
||||
val,
|
||||
config,
|
||||
indentation,
|
||||
depth,
|
||||
refs,
|
||||
printer,
|
||||
val[IS_ORDERED_SENTINEL] ? 'OrderedSet' : 'Set'
|
||||
);
|
||||
}
|
||||
|
||||
if (val[IS_STACK_SENTINEL]) {
|
||||
return printImmutableValues(
|
||||
val,
|
||||
config,
|
||||
indentation,
|
||||
depth,
|
||||
refs,
|
||||
printer,
|
||||
'Stack'
|
||||
);
|
||||
}
|
||||
|
||||
if (val[IS_SEQ_SENTINEL]) {
|
||||
return printImmutableSeq(val, config, indentation, depth, refs, printer);
|
||||
} // For compatibility with immutable v3 and v4, let record be the default.
|
||||
|
||||
return printImmutableRecord(val, config, indentation, depth, refs, printer);
|
||||
}; // Explicitly comparing sentinel properties to true avoids false positive
|
||||
// when mock identity-obj-proxy returns the key as the value for any key.
|
||||
|
||||
exports.serialize = serialize;
|
||||
|
||||
const test = val =>
|
||||
val &&
|
||||
(val[IS_ITERABLE_SENTINEL] === true || val[IS_RECORD_SENTINEL] === true);
|
||||
|
||||
exports.test = test;
|
||||
const plugin = {
|
||||
serialize,
|
||||
test
|
||||
};
|
||||
var _default = plugin;
|
||||
exports.default = _default;
|
12
node_modules/pretty-format/build/plugins/ReactElement.d.ts
generated
vendored
Normal file
12
node_modules/pretty-format/build/plugins/ReactElement.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,12 @@
|
|||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates. 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.
|
||||
*/
|
||||
import { Config, NewPlugin, Printer } from '../types';
|
||||
export declare const serialize: (element: any, config: Config, indentation: string, depth: number, refs: any[], printer: Printer) => string;
|
||||
export declare const test: (val: any) => boolean;
|
||||
declare const plugin: NewPlugin;
|
||||
export default plugin;
|
||||
//# sourceMappingURL=ReactElement.d.ts.map
|
1
node_modules/pretty-format/build/plugins/ReactElement.d.ts.map
generated
vendored
Normal file
1
node_modules/pretty-format/build/plugins/ReactElement.d.ts.map
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"ReactElement.d.ts","sourceRoot":"","sources":["../../src/plugins/ReactElement.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAC,MAAM,EAAE,SAAS,EAAE,OAAO,EAAO,MAAM,UAAU,CAAC;AAuE1D,eAAO,MAAM,SAAS,6GA+Bf,CAAC;AAER,eAAO,MAAM,IAAI,uBAA8C,CAAC;AAEhE,QAAA,MAAM,MAAM,EAAE,SAA6B,CAAC;AAE5C,eAAe,MAAM,CAAC"}
|
144
node_modules/pretty-format/build/plugins/ReactElement.js
generated
vendored
Normal file
144
node_modules/pretty-format/build/plugins/ReactElement.js
generated
vendored
Normal file
|
@ -0,0 +1,144 @@
|
|||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', {
|
||||
value: true
|
||||
});
|
||||
exports.default = exports.test = exports.serialize = void 0;
|
||||
|
||||
var ReactIs = _interopRequireWildcard(require('react-is'));
|
||||
|
||||
var _markup = require('./lib/markup');
|
||||
|
||||
function _interopRequireWildcard(obj) {
|
||||
if (obj && obj.__esModule) {
|
||||
return obj;
|
||||
} else {
|
||||
var newObj = {};
|
||||
if (obj != null) {
|
||||
for (var key in obj) {
|
||||
if (Object.prototype.hasOwnProperty.call(obj, key)) {
|
||||
var desc =
|
||||
Object.defineProperty && Object.getOwnPropertyDescriptor
|
||||
? Object.getOwnPropertyDescriptor(obj, key)
|
||||
: {};
|
||||
if (desc.get || desc.set) {
|
||||
Object.defineProperty(newObj, key, desc);
|
||||
} else {
|
||||
newObj[key] = obj[key];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
newObj.default = obj;
|
||||
return newObj;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates. 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.
|
||||
*/
|
||||
// Given element.props.children, or subtree during recursive traversal,
|
||||
// return flattened array of children.
|
||||
const getChildren = (arg, children = []) => {
|
||||
if (Array.isArray(arg)) {
|
||||
arg.forEach(item => {
|
||||
getChildren(item, children);
|
||||
});
|
||||
} else if (arg != null && arg !== false) {
|
||||
children.push(arg);
|
||||
}
|
||||
|
||||
return children;
|
||||
};
|
||||
|
||||
const getType = element => {
|
||||
const type = element.type;
|
||||
|
||||
if (typeof type === 'string') {
|
||||
return type;
|
||||
}
|
||||
|
||||
if (typeof type === 'function') {
|
||||
return type.displayName || type.name || 'Unknown';
|
||||
}
|
||||
|
||||
if (ReactIs.isFragment(element)) {
|
||||
return 'React.Fragment';
|
||||
}
|
||||
|
||||
if (ReactIs.isSuspense(element)) {
|
||||
return 'React.Suspense';
|
||||
}
|
||||
|
||||
if (typeof type === 'object' && type !== null) {
|
||||
if (ReactIs.isContextProvider(element)) {
|
||||
return 'Context.Provider';
|
||||
}
|
||||
|
||||
if (ReactIs.isContextConsumer(element)) {
|
||||
return 'Context.Consumer';
|
||||
}
|
||||
|
||||
if (ReactIs.isForwardRef(element)) {
|
||||
const functionName = type.render.displayName || type.render.name || '';
|
||||
return functionName !== ''
|
||||
? 'ForwardRef(' + functionName + ')'
|
||||
: 'ForwardRef';
|
||||
}
|
||||
|
||||
if (ReactIs.isMemo(type)) {
|
||||
const functionName = type.type.displayName || type.type.name || '';
|
||||
return functionName !== '' ? 'Memo(' + functionName + ')' : 'Memo';
|
||||
}
|
||||
}
|
||||
|
||||
return 'UNDEFINED';
|
||||
};
|
||||
|
||||
const getPropKeys = element => {
|
||||
const props = element.props;
|
||||
return Object.keys(props)
|
||||
.filter(key => key !== 'children' && props[key] !== undefined)
|
||||
.sort();
|
||||
};
|
||||
|
||||
const serialize = (element, config, indentation, depth, refs, printer) =>
|
||||
++depth > config.maxDepth
|
||||
? (0, _markup.printElementAsLeaf)(getType(element), config)
|
||||
: (0, _markup.printElement)(
|
||||
getType(element),
|
||||
(0, _markup.printProps)(
|
||||
getPropKeys(element),
|
||||
element.props,
|
||||
config,
|
||||
indentation + config.indent,
|
||||
depth,
|
||||
refs,
|
||||
printer
|
||||
),
|
||||
(0, _markup.printChildren)(
|
||||
getChildren(element.props.children),
|
||||
config,
|
||||
indentation + config.indent,
|
||||
depth,
|
||||
refs,
|
||||
printer
|
||||
),
|
||||
config,
|
||||
indentation
|
||||
);
|
||||
|
||||
exports.serialize = serialize;
|
||||
|
||||
const test = val => val && ReactIs.isElement(val);
|
||||
|
||||
exports.test = test;
|
||||
const plugin = {
|
||||
serialize,
|
||||
test
|
||||
};
|
||||
var _default = plugin;
|
||||
exports.default = _default;
|
19
node_modules/pretty-format/build/plugins/ReactTestComponent.d.ts
generated
vendored
Normal file
19
node_modules/pretty-format/build/plugins/ReactTestComponent.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,19 @@
|
|||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates. 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.
|
||||
*/
|
||||
import { Config, Printer, NewPlugin } from '../types';
|
||||
export declare type ReactTestObject = {
|
||||
$$typeof: symbol;
|
||||
type: string;
|
||||
props?: Record<string, any>;
|
||||
children?: null | Array<ReactTestChild>;
|
||||
};
|
||||
declare type ReactTestChild = ReactTestObject | string | number;
|
||||
export declare const serialize: (object: ReactTestObject, config: Config, indentation: string, depth: number, refs: any[], printer: Printer) => string;
|
||||
export declare const test: (val: any) => boolean;
|
||||
declare const plugin: NewPlugin;
|
||||
export default plugin;
|
||||
//# sourceMappingURL=ReactTestComponent.d.ts.map
|
1
node_modules/pretty-format/build/plugins/ReactTestComponent.d.ts.map
generated
vendored
Normal file
1
node_modules/pretty-format/build/plugins/ReactTestComponent.d.ts.map
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"ReactTestComponent.d.ts","sourceRoot":"","sources":["../../src/plugins/ReactTestComponent.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAC,MAAM,EAAE,OAAO,EAAE,SAAS,EAAO,MAAM,UAAU,CAAC;AAE1D,oBAAY,eAAe,GAAG;IAC5B,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC5B,QAAQ,CAAC,EAAE,IAAI,GAAG,KAAK,CAAC,cAAc,CAAC,CAAC;CACzC,CAAC;AAGF,aAAK,cAAc,GAAG,eAAe,GAAG,MAAM,GAAG,MAAM,CAAC;AAqBxD,eAAO,MAAM,SAAS,wHAmCf,CAAC;AAER,eAAO,MAAM,IAAI,uBAAmD,CAAC;AAErE,QAAA,MAAM,MAAM,EAAE,SAA6B,CAAC;AAE5C,eAAe,MAAM,CAAC"}
|
62
node_modules/pretty-format/build/plugins/ReactTestComponent.js
generated
vendored
Normal file
62
node_modules/pretty-format/build/plugins/ReactTestComponent.js
generated
vendored
Normal file
|
@ -0,0 +1,62 @@
|
|||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', {
|
||||
value: true
|
||||
});
|
||||
exports.default = exports.test = exports.serialize = void 0;
|
||||
|
||||
var _markup = require('./lib/markup');
|
||||
|
||||
var Symbol = global['jest-symbol-do-not-touch'] || global.Symbol;
|
||||
const testSymbol = Symbol.for('react.test.json');
|
||||
|
||||
const getPropKeys = object => {
|
||||
const props = object.props;
|
||||
return props
|
||||
? Object.keys(props)
|
||||
.filter(key => props[key] !== undefined)
|
||||
.sort()
|
||||
: [];
|
||||
};
|
||||
|
||||
const serialize = (object, config, indentation, depth, refs, printer) =>
|
||||
++depth > config.maxDepth
|
||||
? (0, _markup.printElementAsLeaf)(object.type, config)
|
||||
: (0, _markup.printElement)(
|
||||
object.type,
|
||||
object.props
|
||||
? (0, _markup.printProps)(
|
||||
getPropKeys(object),
|
||||
object.props,
|
||||
config,
|
||||
indentation + config.indent,
|
||||
depth,
|
||||
refs,
|
||||
printer
|
||||
)
|
||||
: '',
|
||||
object.children
|
||||
? (0, _markup.printChildren)(
|
||||
object.children,
|
||||
config,
|
||||
indentation + config.indent,
|
||||
depth,
|
||||
refs,
|
||||
printer
|
||||
)
|
||||
: '',
|
||||
config,
|
||||
indentation
|
||||
);
|
||||
|
||||
exports.serialize = serialize;
|
||||
|
||||
const test = val => val && val.$$typeof === testSymbol;
|
||||
|
||||
exports.test = test;
|
||||
const plugin = {
|
||||
serialize,
|
||||
test
|
||||
};
|
||||
var _default = plugin;
|
||||
exports.default = _default;
|
8
node_modules/pretty-format/build/plugins/lib/escapeHTML.d.ts
generated
vendored
Normal file
8
node_modules/pretty-format/build/plugins/lib/escapeHTML.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,8 @@
|
|||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates. 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.
|
||||
*/
|
||||
export default function escapeHTML(str: string): string;
|
||||
//# sourceMappingURL=escapeHTML.d.ts.map
|
1
node_modules/pretty-format/build/plugins/lib/escapeHTML.d.ts.map
generated
vendored
Normal file
1
node_modules/pretty-format/build/plugins/lib/escapeHTML.d.ts.map
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"escapeHTML.d.ts","sourceRoot":"","sources":["../../../src/plugins/lib/escapeHTML.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,CAAC,OAAO,UAAU,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAEtD"}
|
16
node_modules/pretty-format/build/plugins/lib/escapeHTML.js
generated
vendored
Normal file
16
node_modules/pretty-format/build/plugins/lib/escapeHTML.js
generated
vendored
Normal file
|
@ -0,0 +1,16 @@
|
|||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', {
|
||||
value: true
|
||||
});
|
||||
exports.default = escapeHTML;
|
||||
|
||||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates. 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 escapeHTML(str) {
|
||||
return str.replace(/</g, '<').replace(/>/g, '>');
|
||||
}
|
14
node_modules/pretty-format/build/plugins/lib/markup.d.ts
generated
vendored
Normal file
14
node_modules/pretty-format/build/plugins/lib/markup.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,14 @@
|
|||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates. 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.
|
||||
*/
|
||||
import { Config, Printer } from '../../types';
|
||||
export declare const printProps: (keys: string[], props: any, config: Config, indentation: string, depth: number, refs: any[], printer: Printer) => string;
|
||||
export declare const printChildren: (children: any[], config: Config, indentation: string, depth: number, refs: any[], printer: Printer) => string;
|
||||
export declare const printText: (text: string, config: Config) => string;
|
||||
export declare const printComment: (comment: string, config: Config) => string;
|
||||
export declare const printElement: (type: string, printedProps: string, printedChildren: string, config: Config, indentation: string) => string;
|
||||
export declare const printElementAsLeaf: (type: string, config: Config) => string;
|
||||
//# sourceMappingURL=markup.d.ts.map
|
1
node_modules/pretty-format/build/plugins/lib/markup.d.ts.map
generated
vendored
Normal file
1
node_modules/pretty-format/build/plugins/lib/markup.d.ts.map
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"markup.d.ts","sourceRoot":"","sources":["../../../src/plugins/lib/markup.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAC,MAAM,EAAE,OAAO,EAAO,MAAM,aAAa,CAAC;AAKlD,eAAO,MAAM,UAAU,2HAyCtB,CAAC;AAGF,eAAO,MAAM,aAAa,gHAiBb,CAAC;AAEd,eAAO,MAAM,SAAS,0CAGrB,CAAC;AAEF,eAAO,MAAM,YAAY,6CASxB,CAAC;AAMF,eAAO,MAAM,YAAY,8GA+BxB,CAAC;AAEF,eAAO,MAAM,kBAAkB,0CAY9B,CAAC"}
|
147
node_modules/pretty-format/build/plugins/lib/markup.js
generated
vendored
Normal file
147
node_modules/pretty-format/build/plugins/lib/markup.js
generated
vendored
Normal file
|
@ -0,0 +1,147 @@
|
|||
'use strict';
|
||||
|
||||
Object.defineProperty(exports, '__esModule', {
|
||||
value: true
|
||||
});
|
||||
exports.printElementAsLeaf = exports.printElement = exports.printComment = exports.printText = exports.printChildren = exports.printProps = void 0;
|
||||
|
||||
var _escapeHTML = _interopRequireDefault(require('./escapeHTML'));
|
||||
|
||||
function _interopRequireDefault(obj) {
|
||||
return obj && obj.__esModule ? obj : {default: obj};
|
||||
}
|
||||
|
||||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates. 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.
|
||||
*/
|
||||
// Return empty string if keys is empty.
|
||||
const printProps = (keys, props, config, indentation, depth, refs, printer) => {
|
||||
const indentationNext = indentation + config.indent;
|
||||
const colors = config.colors;
|
||||
return keys
|
||||
.map(key => {
|
||||
const value = props[key];
|
||||
let printed = printer(value, config, indentationNext, depth, refs);
|
||||
|
||||
if (typeof value !== 'string') {
|
||||
if (printed.indexOf('\n') !== -1) {
|
||||
printed =
|
||||
config.spacingOuter +
|
||||
indentationNext +
|
||||
printed +
|
||||
config.spacingOuter +
|
||||
indentation;
|
||||
}
|
||||
|
||||
printed = '{' + printed + '}';
|
||||
}
|
||||
|
||||
return (
|
||||
config.spacingInner +
|
||||
indentation +
|
||||
colors.prop.open +
|
||||
key +
|
||||
colors.prop.close +
|
||||
'=' +
|
||||
colors.value.open +
|
||||
printed +
|
||||
colors.value.close
|
||||
);
|
||||
})
|
||||
.join('');
|
||||
}; // Return empty string if children is empty.
|
||||
|
||||
exports.printProps = printProps;
|
||||
|
||||
const printChildren = (children, config, indentation, depth, refs, printer) =>
|
||||
children
|
||||
.map(
|
||||
child =>
|
||||
config.spacingOuter +
|
||||
indentation +
|
||||
(typeof child === 'string'
|
||||
? printText(child, config)
|
||||
: printer(child, config, indentation, depth, refs))
|
||||
)
|
||||
.join('');
|
||||
|
||||
exports.printChildren = printChildren;
|
||||
|
||||
const printText = (text, config) => {
|
||||
const contentColor = config.colors.content;
|
||||
return (
|
||||
contentColor.open + (0, _escapeHTML.default)(text) + contentColor.close
|
||||
);
|
||||
};
|
||||
|
||||
exports.printText = printText;
|
||||
|
||||
const printComment = (comment, config) => {
|
||||
const commentColor = config.colors.comment;
|
||||
return (
|
||||
commentColor.open +
|
||||
'<!--' +
|
||||
(0, _escapeHTML.default)(comment) +
|
||||
'-->' +
|
||||
commentColor.close
|
||||
);
|
||||
}; // Separate the functions to format props, children, and element,
|
||||
// so a plugin could override a particular function, if needed.
|
||||
// Too bad, so sad: the traditional (but unnecessary) space
|
||||
// in a self-closing tagColor requires a second test of printedProps.
|
||||
|
||||
exports.printComment = printComment;
|
||||
|
||||
const printElement = (
|
||||
type,
|
||||
printedProps,
|
||||
printedChildren,
|
||||
config,
|
||||
indentation
|
||||
) => {
|
||||
const tagColor = config.colors.tag;
|
||||
return (
|
||||
tagColor.open +
|
||||
'<' +
|
||||
type +
|
||||
(printedProps &&
|
||||
tagColor.close +
|
||||
printedProps +
|
||||
config.spacingOuter +
|
||||
indentation +
|
||||
tagColor.open) +
|
||||
(printedChildren
|
||||
? '>' +
|
||||
tagColor.close +
|
||||
printedChildren +
|
||||
config.spacingOuter +
|
||||
indentation +
|
||||
tagColor.open +
|
||||
'</' +
|
||||
type
|
||||
: (printedProps && !config.min ? '' : ' ') + '/') +
|
||||
'>' +
|
||||
tagColor.close
|
||||
);
|
||||
};
|
||||
|
||||
exports.printElement = printElement;
|
||||
|
||||
const printElementAsLeaf = (type, config) => {
|
||||
const tagColor = config.colors.tag;
|
||||
return (
|
||||
tagColor.open +
|
||||
'<' +
|
||||
type +
|
||||
tagColor.close +
|
||||
' …' +
|
||||
tagColor.open +
|
||||
' />' +
|
||||
tagColor.close
|
||||
);
|
||||
};
|
||||
|
||||
exports.printElementAsLeaf = printElementAsLeaf;
|
101
node_modules/pretty-format/build/types.d.ts
generated
vendored
Normal file
101
node_modules/pretty-format/build/types.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,101 @@
|
|||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates. 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.
|
||||
*/
|
||||
export declare type Colors = {
|
||||
comment: {
|
||||
close: string;
|
||||
open: string;
|
||||
};
|
||||
content: {
|
||||
close: string;
|
||||
open: string;
|
||||
};
|
||||
prop: {
|
||||
close: string;
|
||||
open: string;
|
||||
};
|
||||
tag: {
|
||||
close: string;
|
||||
open: string;
|
||||
};
|
||||
value: {
|
||||
close: string;
|
||||
open: string;
|
||||
};
|
||||
};
|
||||
declare type Indent = (arg0: string) => string;
|
||||
export declare type Refs = Array<any>;
|
||||
declare type Print = (arg0: any) => string;
|
||||
export declare type Theme = {
|
||||
comment: string;
|
||||
content: string;
|
||||
prop: string;
|
||||
tag: string;
|
||||
value: string;
|
||||
};
|
||||
declare type ThemeReceived = {
|
||||
comment?: string;
|
||||
content?: string;
|
||||
prop?: string;
|
||||
tag?: string;
|
||||
value?: string;
|
||||
};
|
||||
export declare type Options = {
|
||||
callToJSON: boolean;
|
||||
escapeRegex: boolean;
|
||||
escapeString: boolean;
|
||||
highlight: boolean;
|
||||
indent: number;
|
||||
maxDepth: number;
|
||||
min: boolean;
|
||||
plugins: Plugins;
|
||||
printFunctionName: boolean;
|
||||
theme: Theme;
|
||||
};
|
||||
export declare type OptionsReceived = {
|
||||
callToJSON?: boolean;
|
||||
escapeRegex?: boolean;
|
||||
escapeString?: boolean;
|
||||
highlight?: boolean;
|
||||
indent?: number;
|
||||
maxDepth?: number;
|
||||
min?: boolean;
|
||||
plugins?: Plugins;
|
||||
printFunctionName?: boolean;
|
||||
theme?: ThemeReceived;
|
||||
};
|
||||
export declare type Config = {
|
||||
callToJSON: boolean;
|
||||
colors: Colors;
|
||||
escapeRegex: boolean;
|
||||
escapeString: boolean;
|
||||
indent: string;
|
||||
maxDepth: number;
|
||||
min: boolean;
|
||||
plugins: Plugins;
|
||||
printFunctionName: boolean;
|
||||
spacingInner: string;
|
||||
spacingOuter: string;
|
||||
};
|
||||
export declare type Printer = (val: any, config: Config, indentation: string, depth: number, refs: Refs, hasCalledToJSON?: boolean) => string;
|
||||
declare type Test = (arg0: any) => boolean;
|
||||
export declare type NewPlugin = {
|
||||
serialize: (val: any, config: Config, indentation: string, depth: number, refs: Refs, printer: Printer) => string;
|
||||
test: Test;
|
||||
};
|
||||
declare type PluginOptions = {
|
||||
edgeSpacing: string;
|
||||
min: boolean;
|
||||
spacing: string;
|
||||
};
|
||||
declare type OldPlugin = {
|
||||
print: (val: any, print: Print, indent: Indent, options: PluginOptions, colors: Colors) => string;
|
||||
test: Test;
|
||||
};
|
||||
export declare type Plugin = NewPlugin | OldPlugin;
|
||||
export declare type Plugins = Array<Plugin>;
|
||||
export {};
|
||||
//# sourceMappingURL=types.d.ts.map
|
1
node_modules/pretty-format/build/types.d.ts.map
generated
vendored
Normal file
1
node_modules/pretty-format/build/types.d.ts.map
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,oBAAY,MAAM,GAAG;IACnB,OAAO,EAAE;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAC,CAAC;IACvC,OAAO,EAAE;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAC,CAAC;IACvC,IAAI,EAAE;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAC,CAAC;IACpC,GAAG,EAAE;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAC,CAAC;IACnC,KAAK,EAAE;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAC,CAAC;CACtC,CAAC;AACF,aAAK,MAAM,GAAG,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,CAAC;AACvC,oBAAY,IAAI,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC;AAC9B,aAAK,KAAK,GAAG,CAAC,IAAI,EAAE,GAAG,KAAK,MAAM,CAAC;AAEnC,oBAAY,KAAK,GAAG;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,aAAK,aAAa,GAAG;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,oBAAY,OAAO,GAAG;IACpB,UAAU,EAAE,OAAO,CAAC;IACpB,WAAW,EAAE,OAAO,CAAC;IACrB,YAAY,EAAE,OAAO,CAAC;IACtB,SAAS,EAAE,OAAO,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,GAAG,EAAE,OAAO,CAAC;IACb,OAAO,EAAE,OAAO,CAAC;IACjB,iBAAiB,EAAE,OAAO,CAAC;IAC3B,KAAK,EAAE,KAAK,CAAC;CACd,CAAC;AAEF,oBAAY,eAAe,GAAG;IAC5B,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,KAAK,CAAC,EAAE,aAAa,CAAC;CACvB,CAAC;AAEF,oBAAY,MAAM,GAAG;IACnB,UAAU,EAAE,OAAO,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,OAAO,CAAC;IACrB,YAAY,EAAE,OAAO,CAAC;IACtB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,GAAG,EAAE,OAAO,CAAC;IACb,OAAO,EAAE,OAAO,CAAC;IACjB,iBAAiB,EAAE,OAAO,CAAC;IAC3B,YAAY,EAAE,MAAM,CAAC;IACrB,YAAY,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF,oBAAY,OAAO,GAAG,CACpB,GAAG,EAAE,GAAG,EACR,MAAM,EAAE,MAAM,EACd,WAAW,EAAE,MAAM,EACnB,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,IAAI,EACV,eAAe,CAAC,EAAE,OAAO,KACtB,MAAM,CAAC;AAEZ,aAAK,IAAI,GAAG,CAAC,IAAI,EAAE,GAAG,KAAK,OAAO,CAAC;AAEnC,oBAAY,SAAS,GAAG;IACtB,SAAS,EAAE,CACT,GAAG,EAAE,GAAG,EACR,MAAM,EAAE,MAAM,EACd,WAAW,EAAE,MAAM,EACnB,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,OAAO,KACb,MAAM,CAAC;IACZ,IAAI,EAAE,IAAI,CAAC;CACZ,CAAC;AAEF,aAAK,aAAa,GAAG;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,GAAG,EAAE,OAAO,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,aAAK,SAAS,GAAG;IACf,KAAK,EAAE,CACL,GAAG,EAAE,GAAG,EACR,KAAK,EAAE,KAAK,EACZ,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,aAAa,EACtB,MAAM,EAAE,MAAM,KACX,MAAM,CAAC;IACZ,IAAI,EAAE,IAAI,CAAC;CACZ,CAAC;AAEF,oBAAY,MAAM,GAAG,SAAS,GAAG,SAAS,CAAC;AAE3C,oBAAY,OAAO,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC"}
|
1
node_modules/pretty-format/build/types.js
generated
vendored
Normal file
1
node_modules/pretty-format/build/types.js
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
'use strict';
|
43
node_modules/pretty-format/package.json
generated
vendored
Normal file
43
node_modules/pretty-format/package.json
generated
vendored
Normal file
|
@ -0,0 +1,43 @@
|
|||
{
|
||||
"name": "pretty-format",
|
||||
"version": "24.8.0",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/facebook/jest.git",
|
||||
"directory": "packages/pretty-format"
|
||||
},
|
||||
"license": "MIT",
|
||||
"description": "Stringify any JavaScript value.",
|
||||
"main": "build/index.js",
|
||||
"types": "build/index.d.ts",
|
||||
"browser": "build-es5/index.js",
|
||||
"author": "James Kyle <me@thejameskyle.com>",
|
||||
"dependencies": {
|
||||
"@jest/types": "^24.8.0",
|
||||
"ansi-regex": "^4.0.0",
|
||||
"ansi-styles": "^3.2.0",
|
||||
"react-is": "^16.8.4"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/ansi-regex": "^4.0.0",
|
||||
"@types/ansi-styles": "^3.2.1",
|
||||
"@types/react": "*",
|
||||
"@types/react-is": "^16.7.1",
|
||||
"@types/react-test-renderer": "*",
|
||||
"immutable": "4.0.0-rc.9",
|
||||
"react": "*",
|
||||
"react-dom": "*",
|
||||
"react-test-renderer": "*"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 6"
|
||||
},
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"gitHead": "845728f24b3ef41e450595c384e9b5c9fdf248a4"
|
||||
|
||||
,"_resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-24.8.0.tgz"
|
||||
,"_integrity": "sha512-P952T7dkrDEplsR+TuY7q3VXDae5Sr7zmQb12JU/NDQa/3CH7/QW0yvqLcGN6jL+zQFKaoJcPc+yJxMTGmosqw=="
|
||||
,"_from": "pretty-format@24.8.0"
|
||||
}
|
215
node_modules/pretty-format/perf/test.js
generated
vendored
Normal file
215
node_modules/pretty-format/perf/test.js
generated
vendored
Normal file
|
@ -0,0 +1,215 @@
|
|||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates. 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.
|
||||
*/
|
||||
|
||||
import util from 'util';
|
||||
|
||||
const chalk = require('chalk');
|
||||
const React = require('react');
|
||||
const ReactTestRenderer = require('react-test-renderer');
|
||||
const leftPad = require('left-pad');
|
||||
const prettyFormat = require('../build');
|
||||
const ReactTestComponent = require('../build/plugins/ReactTestComponent');
|
||||
const worldGeoJson = require('./world.geo.json');
|
||||
|
||||
const NANOSECONDS = 1000000000;
|
||||
let TIMES_TO_RUN = 100000;
|
||||
|
||||
function testCase(name, fn) {
|
||||
let result, error, time, total;
|
||||
|
||||
try {
|
||||
result = fn();
|
||||
} catch (err) {
|
||||
error = err;
|
||||
}
|
||||
|
||||
if (!error) {
|
||||
const start = process.hrtime();
|
||||
|
||||
for (let i = 0; i < TIMES_TO_RUN; i++) {
|
||||
fn();
|
||||
}
|
||||
|
||||
const diff = process.hrtime(start);
|
||||
|
||||
total = diff[0] * 1e9 + diff[1];
|
||||
time = Math.round(total / TIMES_TO_RUN);
|
||||
}
|
||||
|
||||
return {
|
||||
error,
|
||||
name,
|
||||
result,
|
||||
time,
|
||||
total,
|
||||
};
|
||||
}
|
||||
|
||||
function test(name, value, ignoreResult, prettyFormatOpts) {
|
||||
const formatted = testCase('prettyFormat() ', () =>
|
||||
prettyFormat(value, prettyFormatOpts),
|
||||
);
|
||||
|
||||
const inspected = testCase('util.inspect() ', () =>
|
||||
util.inspect(value, {
|
||||
depth: null,
|
||||
showHidden: true,
|
||||
}),
|
||||
);
|
||||
|
||||
const stringified = testCase('JSON.stringify()', () =>
|
||||
JSON.stringify(value, null, ' '),
|
||||
);
|
||||
|
||||
const results = [formatted, inspected, stringified].sort(
|
||||
(a, b) => a.time - b.time,
|
||||
);
|
||||
|
||||
const winner = results[0];
|
||||
|
||||
results.forEach((item, index) => {
|
||||
item.isWinner = index === 0;
|
||||
item.isLoser = index === results.length - 1;
|
||||
});
|
||||
|
||||
function log(current) {
|
||||
let message = current.name;
|
||||
|
||||
if (current.time) {
|
||||
message += ' - ' + leftPad(current.time, 6) + 'ns';
|
||||
}
|
||||
if (current.total) {
|
||||
message +=
|
||||
' - ' +
|
||||
current.total / NANOSECONDS +
|
||||
's total (' +
|
||||
TIMES_TO_RUN +
|
||||
' runs)';
|
||||
}
|
||||
if (current.error) {
|
||||
message += ' - Error: ' + current.error.message;
|
||||
}
|
||||
|
||||
if (!ignoreResult && current.result) {
|
||||
message += ' - ' + JSON.stringify(current.result);
|
||||
}
|
||||
|
||||
message = ' ' + message + ' ';
|
||||
|
||||
if (current.error) {
|
||||
message = chalk.dim(message);
|
||||
}
|
||||
|
||||
const diff = current.time - winner.time;
|
||||
|
||||
if (diff > winner.time * 0.85) {
|
||||
message = chalk.bgRed.black(message);
|
||||
} else if (diff > winner.time * 0.65) {
|
||||
message = chalk.bgYellow.black(message);
|
||||
} else if (!current.error) {
|
||||
message = chalk.bgGreen.black(message);
|
||||
} else {
|
||||
message = chalk.dim(message);
|
||||
}
|
||||
|
||||
console.log(' ' + message);
|
||||
}
|
||||
|
||||
console.log(name + ': ');
|
||||
results.forEach(log);
|
||||
console.log();
|
||||
}
|
||||
|
||||
function returnArguments() {
|
||||
return arguments;
|
||||
}
|
||||
|
||||
test('empty arguments', returnArguments());
|
||||
test('arguments', returnArguments(1, 2, 3));
|
||||
test('an empty array', []);
|
||||
test('an array with items', [1, 2, 3]);
|
||||
test('a typed array', new Uint32Array(3));
|
||||
test('an array buffer', new ArrayBuffer(3));
|
||||
test('a nested array', [[1, 2, 3]]);
|
||||
test('true', true);
|
||||
test('false', false);
|
||||
test('an error', new Error());
|
||||
test('a typed error with a message', new TypeError('message'));
|
||||
/* eslint-disable no-new-func */
|
||||
test('a function constructor', new Function());
|
||||
/* eslint-enable no-new-func */
|
||||
test('an anonymous function', () => {});
|
||||
function named() {}
|
||||
test('a named function', named);
|
||||
test('Infinity', Infinity);
|
||||
test('-Infinity', -Infinity);
|
||||
test('an empty map', new Map());
|
||||
const mapWithValues = new Map();
|
||||
const mapWithNonStringKeys = new Map();
|
||||
mapWithValues.set('prop1', 'value1');
|
||||
mapWithValues.set('prop2', 'value2');
|
||||
mapWithNonStringKeys.set({prop: 'value'}, {prop: 'value'});
|
||||
test('a map with values', mapWithValues);
|
||||
test('a map with non-string keys', mapWithNonStringKeys);
|
||||
test('NaN', NaN);
|
||||
test('null', null);
|
||||
test('a number', 123);
|
||||
test('a date', new Date(10e11));
|
||||
test('an empty object', {});
|
||||
test('an object with properties', {prop1: 'value1', prop2: 'value2'});
|
||||
const objectWithPropsAndSymbols = {prop: 'value1'};
|
||||
objectWithPropsAndSymbols[Symbol('symbol1')] = 'value2';
|
||||
objectWithPropsAndSymbols[Symbol('symbol2')] = 'value3';
|
||||
test('an object with properties and symbols', objectWithPropsAndSymbols);
|
||||
test('an object with sorted properties', {a: 2, b: 1});
|
||||
test('regular expressions from constructors', new RegExp('regexp'));
|
||||
test('regular expressions from literals', /regexp/gi);
|
||||
test('an empty set', new Set());
|
||||
const setWithValues = new Set();
|
||||
setWithValues.add('value1');
|
||||
setWithValues.add('value2');
|
||||
test('a set with values', setWithValues);
|
||||
test('a string', 'string');
|
||||
test('a symbol', Symbol('symbol'));
|
||||
test('undefined', undefined);
|
||||
test('a WeakMap', new WeakMap());
|
||||
test('a WeakSet', new WeakSet());
|
||||
test('deeply nested objects', {prop: {prop: {prop: 'value'}}});
|
||||
const circularReferences = {};
|
||||
circularReferences.prop = circularReferences;
|
||||
test('circular references', circularReferences);
|
||||
const parallelReferencesInner = {};
|
||||
const parallelReferences = {
|
||||
prop1: parallelReferencesInner,
|
||||
prop2: parallelReferencesInner,
|
||||
};
|
||||
test('parallel references', parallelReferences);
|
||||
test('able to customize indent', {prop: 'value'});
|
||||
const bigObj = {};
|
||||
for (let i = 0; i < 50; i++) {
|
||||
bigObj[i] = i;
|
||||
}
|
||||
test('big object', bigObj);
|
||||
|
||||
const element = React.createElement(
|
||||
'div',
|
||||
{onClick: () => {}, prop: {a: 1, b: 2}},
|
||||
React.createElement('div', {prop: {a: 1, b: 2}}),
|
||||
React.createElement('div'),
|
||||
React.createElement(
|
||||
'div',
|
||||
{prop: {a: 1, b: 2}},
|
||||
React.createElement('div', null, React.createElement('div')),
|
||||
),
|
||||
);
|
||||
|
||||
test('react', ReactTestRenderer.create(element).toJSON(), false, {
|
||||
plugins: [ReactTestComponent],
|
||||
});
|
||||
|
||||
TIMES_TO_RUN = 100;
|
||||
test('massive', worldGeoJson, true);
|
182
node_modules/pretty-format/perf/world.geo.json
generated
vendored
Normal file
182
node_modules/pretty-format/perf/world.geo.json
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
8
node_modules/pretty-format/tsconfig.json
generated
vendored
Normal file
8
node_modules/pretty-format/tsconfig.json
generated
vendored
Normal file
|
@ -0,0 +1,8 @@
|
|||
{
|
||||
"extends": "../../tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"rootDir": "src",
|
||||
"outDir": "build"
|
||||
},
|
||||
"references": [{"path": "../jest-types"}]
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue