@casual-simulation/expect 2.0.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +4 -0
- package/index.d.ts +6 -0
- package/index.js +5 -0
- package/index.js.map +1 -0
- package/package.json +35 -0
- package/src/asymmetricMatchers.d.ts +67 -0
- package/src/asymmetricMatchers.js +188 -0
- package/src/asymmetricMatchers.js.map +1 -0
- package/src/diff/cleanupSemantic.d.ts +58 -0
- package/src/diff/cleanupSemantic.js +526 -0
- package/src/diff/cleanupSemantic.js.map +1 -0
- package/src/diff/constants.d.ts +9 -0
- package/src/diff/constants.js +10 -0
- package/src/diff/constants.js.map +1 -0
- package/src/diff/diffLines.d.ts +13 -0
- package/src/diff/diffLines.js +138 -0
- package/src/diff/diffLines.js.map +1 -0
- package/src/diff/diffStrings.d.ts +10 -0
- package/src/diff/diffStrings.js +36 -0
- package/src/diff/diffStrings.js.map +1 -0
- package/src/diff/getAlignedDiffs.d.ts +11 -0
- package/src/diff/getAlignedDiffs.js +187 -0
- package/src/diff/getAlignedDiffs.js.map +1 -0
- package/src/diff/index.d.ts +16 -0
- package/src/diff/index.js +139 -0
- package/src/diff/index.js.map +1 -0
- package/src/diff/joinAlignedDiffs.d.ts +11 -0
- package/src/diff/joinAlignedDiffs.js +191 -0
- package/src/diff/joinAlignedDiffs.js.map +1 -0
- package/src/diff/normalizeDiffOptions.d.ts +10 -0
- package/src/diff/normalizeDiffOptions.js +40 -0
- package/src/diff/normalizeDiffOptions.js.map +1 -0
- package/src/diff/printDiffs.d.ts +11 -0
- package/src/diff/printDiffs.js +46 -0
- package/src/diff/printDiffs.js.map +1 -0
- package/src/diff/types.d.ts +49 -0
- package/src/diff/types.js +2 -0
- package/src/diff/types.js.map +1 -0
- package/src/diff-sequences/index.d.ts +19 -0
- package/src/diff-sequences/index.js +506 -0
- package/src/diff-sequences/index.js.map +1 -0
- package/src/extractExpectedAssertionsErrors.d.ts +11 -0
- package/src/extractExpectedAssertionsErrors.js +58 -0
- package/src/extractExpectedAssertionsErrors.js.map +1 -0
- package/src/get-type/index.d.ts +11 -0
- package/src/get-type/index.js +57 -0
- package/src/get-type/index.js.map +1 -0
- package/src/index.d.ts +16 -0
- package/src/index.js +247 -0
- package/src/index.js.map +1 -0
- package/src/jasmineUtils.d.ts +9 -0
- package/src/jasmineUtils.js +218 -0
- package/src/jasmineUtils.js.map +1 -0
- package/src/jestMatchersObject.d.ts +14 -0
- package/src/jestMatchersObject.js +78 -0
- package/src/jestMatchersObject.js.map +1 -0
- package/src/matcher-utils/Replaceable.d.ts +18 -0
- package/src/matcher-utils/Replaceable.js +57 -0
- package/src/matcher-utils/Replaceable.js.map +1 -0
- package/src/matcher-utils/deepCyclicCopyReplaceable.d.ts +8 -0
- package/src/matcher-utils/deepCyclicCopyReplaceable.js +96 -0
- package/src/matcher-utils/deepCyclicCopyReplaceable.js.map +1 -0
- package/src/matcher-utils/index.d.ts +53 -0
- package/src/matcher-utils/index.js +341 -0
- package/src/matcher-utils/index.js.map +1 -0
- package/src/matchers.d.ts +11 -0
- package/src/matchers.js +575 -0
- package/src/matchers.js.map +1 -0
- package/src/message-util/index.d.ts +11 -0
- package/src/message-util/index.js +34 -0
- package/src/message-util/index.js.map +1 -0
- package/src/pretty-format/collections.d.ts +33 -0
- package/src/pretty-format/collections.js +130 -0
- package/src/pretty-format/collections.js.map +1 -0
- package/src/pretty-format/index.d.ts +25 -0
- package/src/pretty-format/index.js +390 -0
- package/src/pretty-format/index.js.map +1 -0
- package/src/pretty-format/plugins/AsymmetricMatcher.d.ts +12 -0
- package/src/pretty-format/plugins/AsymmetricMatcher.js +53 -0
- package/src/pretty-format/plugins/AsymmetricMatcher.js.map +1 -0
- package/src/pretty-format/plugins/ConvertAnsi.d.ts +12 -0
- package/src/pretty-format/plugins/ConvertAnsi.js +58 -0
- package/src/pretty-format/plugins/ConvertAnsi.js.map +1 -0
- package/src/pretty-format/plugins/DOMCollection.d.ts +12 -0
- package/src/pretty-format/plugins/DOMCollection.js +39 -0
- package/src/pretty-format/plugins/DOMCollection.js.map +1 -0
- package/src/pretty-format/plugins/DOMElement.d.ts +12 -0
- package/src/pretty-format/plugins/DOMElement.js +68 -0
- package/src/pretty-format/plugins/DOMElement.js.map +1 -0
- package/src/pretty-format/plugins/Immutable.d.ts +12 -0
- package/src/pretty-format/plugins/Immutable.js +113 -0
- package/src/pretty-format/plugins/Immutable.js.map +1 -0
- package/src/pretty-format/plugins/ReactTestComponent.d.ts +19 -0
- package/src/pretty-format/plugins/ReactTestComponent.js +29 -0
- package/src/pretty-format/plugins/ReactTestComponent.js.map +1 -0
- package/src/pretty-format/plugins/lib/escapeHTML.d.ts +8 -0
- package/src/pretty-format/plugins/lib/escapeHTML.js +10 -0
- package/src/pretty-format/plugins/lib/escapeHTML.js.map +1 -0
- package/src/pretty-format/plugins/lib/markup.d.ts +14 -0
- package/src/pretty-format/plugins/lib/markup.js +98 -0
- package/src/pretty-format/plugins/lib/markup.js.map +1 -0
- package/src/pretty-format/types.d.ts +109 -0
- package/src/pretty-format/types.js +8 -0
- package/src/pretty-format/types.js.map +1 -0
- package/src/print.d.ts +16 -0
- package/src/print.js +71 -0
- package/src/print.js.map +1 -0
- package/src/spyMatchers.d.ts +10 -0
- package/src/spyMatchers.js +766 -0
- package/src/spyMatchers.js.map +1 -0
- package/src/test-utils/ConditionalTest.d.ts +10 -0
- package/src/test-utils/ConditionalTest.js +25 -0
- package/src/test-utils/ConditionalTest.js.map +1 -0
- package/src/test-utils/alignedAnsiStyleSerializer.d.ts +9 -0
- package/src/test-utils/alignedAnsiStyleSerializer.js +46 -0
- package/src/test-utils/alignedAnsiStyleSerializer.js.map +1 -0
- package/src/test-utils/config.d.ts +10 -0
- package/src/test-utils/config.js +143 -0
- package/src/test-utils/config.js.map +1 -0
- package/src/test-utils/index.d.ts +10 -0
- package/src/test-utils/index.js +10 -0
- package/src/test-utils/index.js.map +1 -0
- package/src/toThrowMatchers.d.ts +12 -0
- package/src/toThrowMatchers.js +258 -0
- package/src/toThrowMatchers.js.map +1 -0
- package/src/types.d.ts +327 -0
- package/src/types.js +9 -0
- package/src/types.js.map +1 -0
- package/src/utils.d.ts +26 -0
- package/src/utils.js +303 -0
- package/src/utils.js.map +1 -0
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
const errorRegexp = /^Error:?\s*$/;
|
|
8
|
+
const removeBlankErrorLine = (str) => str
|
|
9
|
+
.split('\n')
|
|
10
|
+
// Lines saying just `Error:` are useless
|
|
11
|
+
.filter((line) => !errorRegexp.test(line))
|
|
12
|
+
.join('\n')
|
|
13
|
+
.trimRight();
|
|
14
|
+
// jasmine and worker farm sometimes don't give us access to the actual
|
|
15
|
+
// Error object, so we have to regexp out the message from the stack string
|
|
16
|
+
// to format it.
|
|
17
|
+
export const separateMessageFromStack = (content) => {
|
|
18
|
+
if (!content) {
|
|
19
|
+
return { message: '', stack: '' };
|
|
20
|
+
}
|
|
21
|
+
// All lines up to what looks like a stack -- or if nothing looks like a stack
|
|
22
|
+
// (maybe it's a code frame instead), just the first non-empty line.
|
|
23
|
+
// If the error is a plain "Error:" instead of a SyntaxError or TypeError we
|
|
24
|
+
// remove the prefix from the message because it is generally not useful.
|
|
25
|
+
const messageMatch = content.match(/^(?:Error: )?([\s\S]*?(?=\n\s*at\s.*:\d*:\d*)|\s*.*)([\s\S]*)$/);
|
|
26
|
+
if (!messageMatch) {
|
|
27
|
+
// For typescript
|
|
28
|
+
throw new Error('If you hit this error, the regex above is buggy.');
|
|
29
|
+
}
|
|
30
|
+
const message = removeBlankErrorLine(messageMatch[1]);
|
|
31
|
+
const stack = removeBlankErrorLine(messageMatch[2]);
|
|
32
|
+
return { message, stack };
|
|
33
|
+
};
|
|
34
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,WAAW,GAAG,cAAc,CAAC;AAEnC,MAAM,oBAAoB,GAAG,CAAC,GAAW,EAAE,EAAE,CACzC,GAAG;KACE,KAAK,CAAC,IAAI,CAAC;IACZ,yCAAyC;KACxC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;KACzC,IAAI,CAAC,IAAI,CAAC;KACV,SAAS,EAAE,CAAC;AAErB,uEAAuE;AACvE,2EAA2E;AAC3E,gBAAgB;AAChB,MAAM,CAAC,MAAM,wBAAwB,GAAG,CACpC,OAAe,EACmB,EAAE;IACpC,IAAI,CAAC,OAAO,EAAE;QACV,OAAO,EAAE,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC;KACrC;IAED,8EAA8E;IAC9E,oEAAoE;IACpE,4EAA4E;IAC5E,yEAAyE;IACzE,MAAM,YAAY,GAAG,OAAO,CAAC,KAAK,CAC9B,gEAAgE,CACnE,CAAC;IACF,IAAI,CAAC,YAAY,EAAE;QACf,iBAAiB;QACjB,MAAM,IAAI,KAAK,CAAC,kDAAkD,CAAC,CAAC;KACvE;IACD,MAAM,OAAO,GAAG,oBAAoB,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC;IACtD,MAAM,KAAK,GAAG,oBAAoB,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC;IACpD,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;AAC9B,CAAC,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*
|
|
7
|
+
*/
|
|
8
|
+
import type { Config, Printer, Refs } from './types';
|
|
9
|
+
/**
|
|
10
|
+
* Return entries (for example, of a map)
|
|
11
|
+
* with spacing, indentation, and comma
|
|
12
|
+
* without surrounding punctuation (for example, braces)
|
|
13
|
+
*/
|
|
14
|
+
export declare function printIteratorEntries(iterator: Iterator<[unknown, unknown]>, config: Config, indentation: string, depth: number, refs: Refs, printer: Printer, separator?: string): string;
|
|
15
|
+
/**
|
|
16
|
+
* Return values (for example, of a set)
|
|
17
|
+
* with spacing, indentation, and comma
|
|
18
|
+
* without surrounding punctuation (braces or brackets)
|
|
19
|
+
*/
|
|
20
|
+
export declare function printIteratorValues(iterator: Iterator<unknown>, config: Config, indentation: string, depth: number, refs: Refs, printer: Printer): string;
|
|
21
|
+
/**
|
|
22
|
+
* Return items (for example, of an array)
|
|
23
|
+
* with spacing, indentation, and comma
|
|
24
|
+
* without surrounding punctuation (for example, brackets)
|
|
25
|
+
**/
|
|
26
|
+
export declare function printListItems(list: ArrayLike<unknown>, config: Config, indentation: string, depth: number, refs: Refs, printer: Printer): string;
|
|
27
|
+
/**
|
|
28
|
+
* Return properties of an object
|
|
29
|
+
* with spacing, indentation, and comma
|
|
30
|
+
* without surrounding punctuation (for example, braces)
|
|
31
|
+
*/
|
|
32
|
+
export declare function printObjectProperties(val: Record<string, unknown>, config: Config, indentation: string, depth: number, refs: Refs, printer: Printer): string;
|
|
33
|
+
//# sourceMappingURL=collections.d.ts.map
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*
|
|
7
|
+
*/
|
|
8
|
+
const getKeysOfEnumerableProperties = (object, compareKeys) => {
|
|
9
|
+
const keys = Object.keys(object).sort(compareKeys);
|
|
10
|
+
if (Object.getOwnPropertySymbols) {
|
|
11
|
+
Object.getOwnPropertySymbols(object).forEach((symbol) => {
|
|
12
|
+
if (Object.getOwnPropertyDescriptor(object, symbol).enumerable) {
|
|
13
|
+
keys.push(symbol);
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
return keys;
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* Return entries (for example, of a map)
|
|
21
|
+
* with spacing, indentation, and comma
|
|
22
|
+
* without surrounding punctuation (for example, braces)
|
|
23
|
+
*/
|
|
24
|
+
export function printIteratorEntries(iterator, config, indentation, depth, refs, printer,
|
|
25
|
+
// Too bad, so sad that separator for ECMAScript Map has been ' => '
|
|
26
|
+
// What a distracting diff if you change a data structure to/from
|
|
27
|
+
// ECMAScript Object or Immutable.Map/OrderedMap which use the default.
|
|
28
|
+
separator = ': ') {
|
|
29
|
+
let result = '';
|
|
30
|
+
let current = iterator.next();
|
|
31
|
+
if (!current.done) {
|
|
32
|
+
result += config.spacingOuter;
|
|
33
|
+
const indentationNext = indentation + config.indent;
|
|
34
|
+
while (!current.done) {
|
|
35
|
+
const name = printer(current.value[0], config, indentationNext, depth, refs);
|
|
36
|
+
const value = printer(current.value[1], config, indentationNext, depth, refs);
|
|
37
|
+
result += indentationNext + name + separator + value;
|
|
38
|
+
current = iterator.next();
|
|
39
|
+
if (!current.done) {
|
|
40
|
+
result += ',' + config.spacingInner;
|
|
41
|
+
}
|
|
42
|
+
else if (!config.min) {
|
|
43
|
+
result += ',';
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
result += config.spacingOuter + indentation;
|
|
47
|
+
}
|
|
48
|
+
return result;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Return values (for example, of a set)
|
|
52
|
+
* with spacing, indentation, and comma
|
|
53
|
+
* without surrounding punctuation (braces or brackets)
|
|
54
|
+
*/
|
|
55
|
+
export function printIteratorValues(iterator, config, indentation, depth, refs, printer) {
|
|
56
|
+
let result = '';
|
|
57
|
+
let current = iterator.next();
|
|
58
|
+
if (!current.done) {
|
|
59
|
+
result += config.spacingOuter;
|
|
60
|
+
const indentationNext = indentation + config.indent;
|
|
61
|
+
while (!current.done) {
|
|
62
|
+
result +=
|
|
63
|
+
indentationNext +
|
|
64
|
+
printer(current.value, config, indentationNext, depth, refs);
|
|
65
|
+
current = iterator.next();
|
|
66
|
+
if (!current.done) {
|
|
67
|
+
result += ',' + config.spacingInner;
|
|
68
|
+
}
|
|
69
|
+
else if (!config.min) {
|
|
70
|
+
result += ',';
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
result += config.spacingOuter + indentation;
|
|
74
|
+
}
|
|
75
|
+
return result;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Return items (for example, of an array)
|
|
79
|
+
* with spacing, indentation, and comma
|
|
80
|
+
* without surrounding punctuation (for example, brackets)
|
|
81
|
+
**/
|
|
82
|
+
export function printListItems(list, config, indentation, depth, refs, printer) {
|
|
83
|
+
let result = '';
|
|
84
|
+
if (list.length) {
|
|
85
|
+
result += config.spacingOuter;
|
|
86
|
+
const indentationNext = indentation + config.indent;
|
|
87
|
+
for (let i = 0; i < list.length; i++) {
|
|
88
|
+
result += indentationNext;
|
|
89
|
+
if (i in list) {
|
|
90
|
+
result += printer(list[i], config, indentationNext, depth, refs);
|
|
91
|
+
}
|
|
92
|
+
if (i < list.length - 1) {
|
|
93
|
+
result += ',' + config.spacingInner;
|
|
94
|
+
}
|
|
95
|
+
else if (!config.min) {
|
|
96
|
+
result += ',';
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
result += config.spacingOuter + indentation;
|
|
100
|
+
}
|
|
101
|
+
return result;
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Return properties of an object
|
|
105
|
+
* with spacing, indentation, and comma
|
|
106
|
+
* without surrounding punctuation (for example, braces)
|
|
107
|
+
*/
|
|
108
|
+
export function printObjectProperties(val, config, indentation, depth, refs, printer) {
|
|
109
|
+
let result = '';
|
|
110
|
+
const keys = getKeysOfEnumerableProperties(val, config.compareKeys);
|
|
111
|
+
if (keys.length) {
|
|
112
|
+
result += config.spacingOuter;
|
|
113
|
+
const indentationNext = indentation + config.indent;
|
|
114
|
+
for (let i = 0; i < keys.length; i++) {
|
|
115
|
+
const key = keys[i];
|
|
116
|
+
const name = printer(key, config, indentationNext, depth, refs);
|
|
117
|
+
const value = printer(val[key], config, indentationNext, depth, refs);
|
|
118
|
+
result += indentationNext + name + ': ' + value;
|
|
119
|
+
if (i < keys.length - 1) {
|
|
120
|
+
result += ',' + config.spacingInner;
|
|
121
|
+
}
|
|
122
|
+
else if (!config.min) {
|
|
123
|
+
result += ',';
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
result += config.spacingOuter + indentation;
|
|
127
|
+
}
|
|
128
|
+
return result;
|
|
129
|
+
}
|
|
130
|
+
//# sourceMappingURL=collections.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"collections.js","sourceRoot":"","sources":["collections.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,MAAM,6BAA6B,GAAG,CAClC,MAA+B,EAC/B,WAAwB,EAC1B,EAAE;IACA,MAAM,IAAI,GAA2B,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;IAE3E,IAAI,MAAM,CAAC,qBAAqB,EAAE;QAC9B,MAAM,CAAC,qBAAqB,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE,EAAE;YACpD,IAAI,MAAM,CAAC,wBAAwB,CAAC,MAAM,EAAE,MAAM,CAAE,CAAC,UAAU,EAAE;gBAC7D,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;aACrB;QACL,CAAC,CAAC,CAAC;KACN;IAED,OAAO,IAAqB,CA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M,GAAG,CAAC,EAAE;gBACrB,MAAM,IAAI,GAAG,GAAG,MAAM,CAAC,YAAY,CAAC;aACvC;iBAAM,IAAI,CAAC,MAAM,CAAC,GAAG,EAAE;gBACpB,MAAM,IAAI,GAAG,CAAC;aACjB;SACJ;QAED,MAAM,IAAI,MAAM,CAAC,YAAY,GAAG,WAAW,CAAC;KAC/C;IAED,OAAO,MAAM,CAAC;AAClB,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
import type { NewPlugin, Options, OptionsReceived } from './types';
|
|
8
|
+
export type { Colors, CompareKeys, Config, Options, OptionsReceived, OldPlugin, NewPlugin, Plugin, Plugins, PrettyFormatOptions, Printer, Refs, Theme, } from './types';
|
|
9
|
+
export declare const DEFAULT_OPTIONS: Options;
|
|
10
|
+
/**
|
|
11
|
+
* Returns a presentation string of your `val` object
|
|
12
|
+
* @param val any potential JavaScript object
|
|
13
|
+
* @param options Custom settings
|
|
14
|
+
*/
|
|
15
|
+
export declare function format(val: unknown, options?: OptionsReceived): string;
|
|
16
|
+
export declare const plugins: {
|
|
17
|
+
AsymmetricMatcher: NewPlugin;
|
|
18
|
+
ConvertAnsi: NewPlugin;
|
|
19
|
+
DOMCollection: NewPlugin;
|
|
20
|
+
DOMElement: NewPlugin;
|
|
21
|
+
Immutable: NewPlugin;
|
|
22
|
+
ReactTestComponent: NewPlugin;
|
|
23
|
+
};
|
|
24
|
+
export default format;
|
|
25
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,390 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
/* eslint-disable local/ban-types-eventually */
|
|
8
|
+
import style from '@casual-simulation/chalk/ansi-styles';
|
|
9
|
+
import { printIteratorEntries, printIteratorValues, printListItems, printObjectProperties, } from './collections';
|
|
10
|
+
import AsymmetricMatcher from './plugins/AsymmetricMatcher';
|
|
11
|
+
import ConvertAnsi from './plugins/ConvertAnsi';
|
|
12
|
+
import DOMCollection from './plugins/DOMCollection';
|
|
13
|
+
import DOMElement from './plugins/DOMElement';
|
|
14
|
+
import Immutable from './plugins/Immutable';
|
|
15
|
+
import ReactTestComponent from './plugins/ReactTestComponent';
|
|
16
|
+
const toString = Object.prototype.toString;
|
|
17
|
+
const toISOString = Date.prototype.toISOString;
|
|
18
|
+
const errorToString = Error.prototype.toString;
|
|
19
|
+
const regExpToString = RegExp.prototype.toString;
|
|
20
|
+
/**
|
|
21
|
+
* Explicitly comparing typeof constructor to function avoids undefined as name
|
|
22
|
+
* when mock identity-obj-proxy returns the key as the value for any key.
|
|
23
|
+
*/
|
|
24
|
+
const getConstructorName = (val) => (typeof val.constructor === 'function' && val.constructor.name) || 'Object';
|
|
25
|
+
/* global window */
|
|
26
|
+
/** Is val is equal to global window object? Works even if it does not exist :) */
|
|
27
|
+
const isWindow = (val) => typeof window !== 'undefined' && val === window;
|
|
28
|
+
const SYMBOL_REGEXP = /^Symbol\((.*)\)(.*)$/;
|
|
29
|
+
const NEWLINE_REGEXP = /\n/gi;
|
|
30
|
+
class PrettyFormatPluginError extends Error {
|
|
31
|
+
constructor(message, stack) {
|
|
32
|
+
super(message);
|
|
33
|
+
this.stack = stack;
|
|
34
|
+
this.name = this.constructor.name;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
function isToStringedArrayType(toStringed) {
|
|
38
|
+
return (toStringed === '[object Array]' ||
|
|
39
|
+
toStringed === '[object ArrayBuffer]' ||
|
|
40
|
+
toStringed === '[object DataView]' ||
|
|
41
|
+
toStringed === '[object Float32Array]' ||
|
|
42
|
+
toStringed === '[object Float64Array]' ||
|
|
43
|
+
toStringed === '[object Int8Array]' ||
|
|
44
|
+
toStringed === '[object Int16Array]' ||
|
|
45
|
+
toStringed === '[object Int32Array]' ||
|
|
46
|
+
toStringed === '[object Uint8Array]' ||
|
|
47
|
+
toStringed === '[object Uint8ClampedArray]' ||
|
|
48
|
+
toStringed === '[object Uint16Array]' ||
|
|
49
|
+
toStringed === '[object Uint32Array]');
|
|
50
|
+
}
|
|
51
|
+
function printNumber(val) {
|
|
52
|
+
return Object.is(val, -0) ? '-0' : String(val);
|
|
53
|
+
}
|
|
54
|
+
function printBigInt(val) {
|
|
55
|
+
return String(`${val}n`);
|
|
56
|
+
}
|
|
57
|
+
function printFunction(val, printFunctionName) {
|
|
58
|
+
if (!printFunctionName) {
|
|
59
|
+
return '[Function]';
|
|
60
|
+
}
|
|
61
|
+
return '[Function ' + (val.name || 'anonymous') + ']';
|
|
62
|
+
}
|
|
63
|
+
function printSymbol(val) {
|
|
64
|
+
return String(val).replace(SYMBOL_REGEXP, 'Symbol($1)');
|
|
65
|
+
}
|
|
66
|
+
function printError(val) {
|
|
67
|
+
return '[' + errorToString.call(val) + ']';
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* The first port of call for printing an object, handles most of the
|
|
71
|
+
* data-types in JS.
|
|
72
|
+
*/
|
|
73
|
+
function printBasicValue(val, printFunctionName, escapeRegex, escapeString) {
|
|
74
|
+
if (val === true || val === false) {
|
|
75
|
+
return '' + val;
|
|
76
|
+
}
|
|
77
|
+
if (val === undefined) {
|
|
78
|
+
return 'undefined';
|
|
79
|
+
}
|
|
80
|
+
if (val === null) {
|
|
81
|
+
return 'null';
|
|
82
|
+
}
|
|
83
|
+
const typeOf = typeof val;
|
|
84
|
+
if (typeOf === 'number') {
|
|
85
|
+
return printNumber(val);
|
|
86
|
+
}
|
|
87
|
+
if (typeOf === 'bigint') {
|
|
88
|
+
return printBigInt(val);
|
|
89
|
+
}
|
|
90
|
+
if (typeOf === 'string') {
|
|
91
|
+
if (escapeString) {
|
|
92
|
+
return '"' + val.replace(/"|\\/g, '\\$&') + '"';
|
|
93
|
+
}
|
|
94
|
+
return '"' + val + '"';
|
|
95
|
+
}
|
|
96
|
+
if (typeOf === 'function') {
|
|
97
|
+
return printFunction(val, printFunctionName);
|
|
98
|
+
}
|
|
99
|
+
if (typeOf === 'symbol') {
|
|
100
|
+
return printSymbol(val);
|
|
101
|
+
}
|
|
102
|
+
const toStringed = toString.call(val);
|
|
103
|
+
if (toStringed === '[object WeakMap]') {
|
|
104
|
+
return 'WeakMap {}';
|
|
105
|
+
}
|
|
106
|
+
if (toStringed === '[object WeakSet]') {
|
|
107
|
+
return 'WeakSet {}';
|
|
108
|
+
}
|
|
109
|
+
if (toStringed === '[object Function]' ||
|
|
110
|
+
toStringed === '[object GeneratorFunction]') {
|
|
111
|
+
return printFunction(val, printFunctionName);
|
|
112
|
+
}
|
|
113
|
+
if (toStringed === '[object Symbol]') {
|
|
114
|
+
return printSymbol(val);
|
|
115
|
+
}
|
|
116
|
+
if (toStringed === '[object Date]') {
|
|
117
|
+
return isNaN(+val) ? 'Date { NaN }' : toISOString.call(val);
|
|
118
|
+
}
|
|
119
|
+
if (toStringed === '[object Error]') {
|
|
120
|
+
return printError(val);
|
|
121
|
+
}
|
|
122
|
+
if (toStringed === '[object RegExp]') {
|
|
123
|
+
if (escapeRegex) {
|
|
124
|
+
// https://github.com/benjamingr/RegExp.escape/blob/main/polyfill.js
|
|
125
|
+
return regExpToString
|
|
126
|
+
.call(val)
|
|
127
|
+
.replace(/[\\^$*+?.()|[\]{}]/g, '\\$&');
|
|
128
|
+
}
|
|
129
|
+
return regExpToString.call(val);
|
|
130
|
+
}
|
|
131
|
+
if (val instanceof Error) {
|
|
132
|
+
return printError(val);
|
|
133
|
+
}
|
|
134
|
+
return null;
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Handles more complex objects ( such as objects with circular references.
|
|
138
|
+
* maps and sets etc )
|
|
139
|
+
*/
|
|
140
|
+
function printComplexValue(val, config, indentation, depth, refs, hasCalledToJSON) {
|
|
141
|
+
if (refs.indexOf(val) !== -1) {
|
|
142
|
+
return '[Circular]';
|
|
143
|
+
}
|
|
144
|
+
refs = refs.slice();
|
|
145
|
+
refs.push(val);
|
|
146
|
+
const hitMaxDepth = ++depth > config.maxDepth;
|
|
147
|
+
const min = config.min;
|
|
148
|
+
if (config.callToJSON &&
|
|
149
|
+
!hitMaxDepth &&
|
|
150
|
+
val.toJSON &&
|
|
151
|
+
typeof val.toJSON === 'function' &&
|
|
152
|
+
!hasCalledToJSON) {
|
|
153
|
+
return printer(val.toJSON(), config, indentation, depth, refs, true);
|
|
154
|
+
}
|
|
155
|
+
const toStringed = toString.call(val);
|
|
156
|
+
if (toStringed === '[object Arguments]') {
|
|
157
|
+
return hitMaxDepth
|
|
158
|
+
? '[Arguments]'
|
|
159
|
+
: (min ? '' : 'Arguments ') +
|
|
160
|
+
'[' +
|
|
161
|
+
printListItems(val, config, indentation, depth, refs, printer) +
|
|
162
|
+
']';
|
|
163
|
+
}
|
|
164
|
+
if (isToStringedArrayType(toStringed)) {
|
|
165
|
+
return hitMaxDepth
|
|
166
|
+
? '[' + val.constructor.name + ']'
|
|
167
|
+
: (min
|
|
168
|
+
? ''
|
|
169
|
+
: !config.printBasicPrototype &&
|
|
170
|
+
val.constructor.name === 'Array'
|
|
171
|
+
? ''
|
|
172
|
+
: val.constructor.name + ' ') +
|
|
173
|
+
'[' +
|
|
174
|
+
printListItems(val, config, indentation, depth, refs, printer) +
|
|
175
|
+
']';
|
|
176
|
+
}
|
|
177
|
+
if (toStringed === '[object Map]') {
|
|
178
|
+
return hitMaxDepth
|
|
179
|
+
? '[Map]'
|
|
180
|
+
: 'Map {' +
|
|
181
|
+
printIteratorEntries(val.entries(), config, indentation, depth, refs, printer, ' => ') +
|
|
182
|
+
'}';
|
|
183
|
+
}
|
|
184
|
+
if (toStringed === '[object Set]') {
|
|
185
|
+
return hitMaxDepth
|
|
186
|
+
? '[Set]'
|
|
187
|
+
: 'Set {' +
|
|
188
|
+
printIteratorValues(val.values(), config, indentation, depth, refs, printer) +
|
|
189
|
+
'}';
|
|
190
|
+
}
|
|
191
|
+
// Avoid failure to serialize global window object in jsdom test environment.
|
|
192
|
+
// For example, not even relevant if window is prop of React element.
|
|
193
|
+
return hitMaxDepth || isWindow(val)
|
|
194
|
+
? '[' + getConstructorName(val) + ']'
|
|
195
|
+
: (min
|
|
196
|
+
? ''
|
|
197
|
+
: !config.printBasicPrototype &&
|
|
198
|
+
getConstructorName(val) === 'Object'
|
|
199
|
+
? ''
|
|
200
|
+
: getConstructorName(val) + ' ') +
|
|
201
|
+
'{' +
|
|
202
|
+
printObjectProperties(val, config, indentation, depth, refs, printer) +
|
|
203
|
+
'}';
|
|
204
|
+
}
|
|
205
|
+
function isNewPlugin(plugin) {
|
|
206
|
+
return plugin.serialize != null;
|
|
207
|
+
}
|
|
208
|
+
function printPlugin(plugin, val, config, indentation, depth, refs) {
|
|
209
|
+
let printed;
|
|
210
|
+
try {
|
|
211
|
+
printed = isNewPlugin(plugin)
|
|
212
|
+
? plugin.serialize(val, config, indentation, depth, refs, printer)
|
|
213
|
+
: plugin.print(val, (valChild) => printer(valChild, config, indentation, depth, refs), (str) => {
|
|
214
|
+
const indentationNext = indentation + config.indent;
|
|
215
|
+
return (indentationNext +
|
|
216
|
+
str.replace(NEWLINE_REGEXP, '\n' + indentationNext));
|
|
217
|
+
}, {
|
|
218
|
+
edgeSpacing: config.spacingOuter,
|
|
219
|
+
min: config.min,
|
|
220
|
+
spacing: config.spacingInner,
|
|
221
|
+
}, config.colors);
|
|
222
|
+
}
|
|
223
|
+
catch (error) {
|
|
224
|
+
throw new PrettyFormatPluginError(error.message, error.stack);
|
|
225
|
+
}
|
|
226
|
+
if (typeof printed !== 'string') {
|
|
227
|
+
throw new Error(`pretty-format: Plugin must return type "string" but instead returned "${typeof printed}".`);
|
|
228
|
+
}
|
|
229
|
+
return printed;
|
|
230
|
+
}
|
|
231
|
+
function findPlugin(plugins, val) {
|
|
232
|
+
for (let p = 0; p < plugins.length; p++) {
|
|
233
|
+
try {
|
|
234
|
+
if (plugins[p].test(val)) {
|
|
235
|
+
return plugins[p];
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
catch (error) {
|
|
239
|
+
throw new PrettyFormatPluginError(error.message, error.stack);
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
return null;
|
|
243
|
+
}
|
|
244
|
+
function printer(val, config, indentation, depth, refs, hasCalledToJSON) {
|
|
245
|
+
const plugin = findPlugin(config.plugins, val);
|
|
246
|
+
if (plugin !== null) {
|
|
247
|
+
return printPlugin(plugin, val, config, indentation, depth, refs);
|
|
248
|
+
}
|
|
249
|
+
const basicResult = printBasicValue(val, config.printFunctionName, config.escapeRegex, config.escapeString);
|
|
250
|
+
if (basicResult !== null) {
|
|
251
|
+
return basicResult;
|
|
252
|
+
}
|
|
253
|
+
return printComplexValue(val, config, indentation, depth, refs, hasCalledToJSON);
|
|
254
|
+
}
|
|
255
|
+
const DEFAULT_THEME = {
|
|
256
|
+
comment: 'gray',
|
|
257
|
+
content: 'reset',
|
|
258
|
+
prop: 'yellow',
|
|
259
|
+
tag: 'cyan',
|
|
260
|
+
value: 'green',
|
|
261
|
+
};
|
|
262
|
+
const DEFAULT_THEME_KEYS = Object.keys(DEFAULT_THEME);
|
|
263
|
+
export const DEFAULT_OPTIONS = {
|
|
264
|
+
callToJSON: true,
|
|
265
|
+
compareKeys: undefined,
|
|
266
|
+
escapeRegex: false,
|
|
267
|
+
escapeString: true,
|
|
268
|
+
highlight: false,
|
|
269
|
+
indent: 2,
|
|
270
|
+
maxDepth: Infinity,
|
|
271
|
+
min: false,
|
|
272
|
+
plugins: [],
|
|
273
|
+
printBasicPrototype: true,
|
|
274
|
+
printFunctionName: true,
|
|
275
|
+
theme: DEFAULT_THEME,
|
|
276
|
+
};
|
|
277
|
+
function validateOptions(options) {
|
|
278
|
+
Object.keys(options).forEach((key) => {
|
|
279
|
+
if (!DEFAULT_OPTIONS.hasOwnProperty(key)) {
|
|
280
|
+
throw new Error(`pretty-format: Unknown option "${key}".`);
|
|
281
|
+
}
|
|
282
|
+
});
|
|
283
|
+
if (options.min && options.indent !== undefined && options.indent !== 0) {
|
|
284
|
+
throw new Error('pretty-format: Options "min" and "indent" cannot be used together.');
|
|
285
|
+
}
|
|
286
|
+
if (options.theme !== undefined) {
|
|
287
|
+
if (options.theme === null) {
|
|
288
|
+
throw new Error(`pretty-format: Option "theme" must not be null.`);
|
|
289
|
+
}
|
|
290
|
+
if (typeof options.theme !== 'object') {
|
|
291
|
+
throw new Error(`pretty-format: Option "theme" must be of type "object" but instead received "${typeof options.theme}".`);
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
const getColorsHighlight = (options) => DEFAULT_THEME_KEYS.reduce((colors, key) => {
|
|
296
|
+
const value = options.theme && options.theme[key] !== undefined
|
|
297
|
+
? options.theme[key]
|
|
298
|
+
: DEFAULT_THEME[key];
|
|
299
|
+
const color = value && style[value];
|
|
300
|
+
if (color &&
|
|
301
|
+
typeof color.close === 'string' &&
|
|
302
|
+
typeof color.open === 'string') {
|
|
303
|
+
colors[key] = color;
|
|
304
|
+
}
|
|
305
|
+
else {
|
|
306
|
+
throw new Error(`pretty-format: Option "theme" has a key "${key}" whose value "${value}" is undefined in ansi-styles.`);
|
|
307
|
+
}
|
|
308
|
+
return colors;
|
|
309
|
+
}, Object.create(null));
|
|
310
|
+
const getColorsEmpty = () => DEFAULT_THEME_KEYS.reduce((colors, key) => {
|
|
311
|
+
colors[key] = { close: '', open: '' };
|
|
312
|
+
return colors;
|
|
313
|
+
}, Object.create(null));
|
|
314
|
+
const getPrintFunctionName = (options) => options && options.printFunctionName !== undefined
|
|
315
|
+
? options.printFunctionName
|
|
316
|
+
: DEFAULT_OPTIONS.printFunctionName;
|
|
317
|
+
const getEscapeRegex = (options) => options && options.escapeRegex !== undefined
|
|
318
|
+
? options.escapeRegex
|
|
319
|
+
: DEFAULT_OPTIONS.escapeRegex;
|
|
320
|
+
const getEscapeString = (options) => options && options.escapeString !== undefined
|
|
321
|
+
? options.escapeString
|
|
322
|
+
: DEFAULT_OPTIONS.escapeString;
|
|
323
|
+
const getConfig = (options) => {
|
|
324
|
+
var _a;
|
|
325
|
+
return ({
|
|
326
|
+
callToJSON: options && options.callToJSON !== undefined
|
|
327
|
+
? options.callToJSON
|
|
328
|
+
: DEFAULT_OPTIONS.callToJSON,
|
|
329
|
+
colors: options && options.highlight
|
|
330
|
+
? getColorsHighlight(options)
|
|
331
|
+
: getColorsEmpty(),
|
|
332
|
+
compareKeys: options && typeof options.compareKeys === 'function'
|
|
333
|
+
? options.compareKeys
|
|
334
|
+
: DEFAULT_OPTIONS.compareKeys,
|
|
335
|
+
escapeRegex: getEscapeRegex(options),
|
|
336
|
+
escapeString: getEscapeString(options),
|
|
337
|
+
indent: options && options.min
|
|
338
|
+
? ''
|
|
339
|
+
: createIndent(options && options.indent !== undefined
|
|
340
|
+
? options.indent
|
|
341
|
+
: DEFAULT_OPTIONS.indent),
|
|
342
|
+
maxDepth: options && options.maxDepth !== undefined
|
|
343
|
+
? options.maxDepth
|
|
344
|
+
: DEFAULT_OPTIONS.maxDepth,
|
|
345
|
+
min: options && options.min !== undefined
|
|
346
|
+
? options.min
|
|
347
|
+
: DEFAULT_OPTIONS.min,
|
|
348
|
+
plugins: options && options.plugins !== undefined
|
|
349
|
+
? options.plugins
|
|
350
|
+
: DEFAULT_OPTIONS.plugins,
|
|
351
|
+
printBasicPrototype: (_a = options === null || options === void 0 ? void 0 : options.printBasicPrototype) !== null && _a !== void 0 ? _a : true,
|
|
352
|
+
printFunctionName: getPrintFunctionName(options),
|
|
353
|
+
spacingInner: options && options.min ? ' ' : '\n',
|
|
354
|
+
spacingOuter: options && options.min ? '' : '\n',
|
|
355
|
+
});
|
|
356
|
+
};
|
|
357
|
+
function createIndent(indent) {
|
|
358
|
+
return new Array(indent + 1).join(' ');
|
|
359
|
+
}
|
|
360
|
+
/**
|
|
361
|
+
* Returns a presentation string of your `val` object
|
|
362
|
+
* @param val any potential JavaScript object
|
|
363
|
+
* @param options Custom settings
|
|
364
|
+
*/
|
|
365
|
+
export function format(val, options) {
|
|
366
|
+
if (options) {
|
|
367
|
+
validateOptions(options);
|
|
368
|
+
if (options.plugins) {
|
|
369
|
+
const plugin = findPlugin(options.plugins, val);
|
|
370
|
+
if (plugin !== null) {
|
|
371
|
+
return printPlugin(plugin, val, getConfig(options), '', 0, []);
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
const basicResult = printBasicValue(val, getPrintFunctionName(options), getEscapeRegex(options), getEscapeString(options));
|
|
376
|
+
if (basicResult !== null) {
|
|
377
|
+
return basicResult;
|
|
378
|
+
}
|
|
379
|
+
return printComplexValue(val, getConfig(options), '', 0, []);
|
|
380
|
+
}
|
|
381
|
+
export const plugins = {
|
|
382
|
+
AsymmetricMatcher,
|
|
383
|
+
ConvertAnsi,
|
|
384
|
+
DOMCollection,
|
|
385
|
+
DOMElement,
|
|
386
|
+
Immutable,
|
|
387
|
+
ReactTestComponent,
|
|
388
|
+
};
|
|
389
|
+
export default format;
|
|
390
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,+CAA+C;AAE/C,OAAO,KAAK,MAAM,sCAAsC,CAAC;AACzD,OAAO,EACH,oBAAoB,EACpB,mBAAmB,EACnB,cAAc,EACd,qBAAqB,GACxB,MAAM,eAAe,CAAC;AACvB,OAAO,iBAAiB,MAAM,6BAA6B,CAAC;AAC5D,OAAO,WAAW,MAAM,uBAAuB,CAAC;AAChD,OAAO,aAAa,MAAM,yBAAyB,CAAC;AACpD,OAAO,UAA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EAAE;gBACjB,OAAO,WAAW,CAAC,MAAM,EAAE,GAAG,EAAE,SAAS,CAAC,OAAO,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC;aAClE;SACJ;KACJ;IAED,MAAM,WAAW,GAAG,eAAe,CAC/B,GAAG,EACH,oBAAoB,CAAC,OAAO,CAAC,EAC7B,cAAc,CAAC,OAAO,CAAC,EACvB,eAAe,CAAC,OAAO,CAAC,CAC3B,CAAC;IACF,IAAI,WAAW,KAAK,IAAI,EAAE;QACtB,OAAO,WAAW,CAAC;KACtB;IAED,OAAO,iBAAiB,CAAC,GAAG,EAAE,SAAS,CAAC,OAAO,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC;AACjE,CAAC;AAED,MAAM,CAAC,MAAM,OAAO,GAAG;IACnB,iBAAiB;IACjB,WAAW;IACX,aAAa;IACb,UAAU;IACV,SAAS;IACT,kBAAkB;CACrB,CAAC;AAEF,eAAe,MAAM,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
import type { NewPlugin } from '../types';
|
|
8
|
+
export declare const serialize: NewPlugin['serialize'];
|
|
9
|
+
export declare const test: NewPlugin['test'];
|
|
10
|
+
declare const plugin: NewPlugin;
|
|
11
|
+
export default plugin;
|
|
12
|
+
//# sourceMappingURL=AsymmetricMatcher.d.ts.map
|