@casual-simulation/expect 3.1.14-alpha.3661157217 → 3.1.28
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/package.json +3 -3
- package/src/diff/types.d.ts +3 -3
- package/src/diff-sequences/index.d.ts +3 -3
- package/src/get-type/index.d.ts +1 -1
- package/src/matcher-utils/Replaceable.d.ts +1 -1
- package/src/matcher-utils/index.d.ts +4 -4
- package/src/pretty-format/plugins/ReactTestComponent.d.ts +2 -2
- package/src/pretty-format/types.d.ts +17 -17
- package/src/types.d.ts +11 -11
- package/src/utils.d.ts +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@casual-simulation/expect",
|
|
3
|
-
"version": "3.1.
|
|
3
|
+
"version": "3.1.28",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/casual-simulation/casualos.git",
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"module": "index",
|
|
12
12
|
"types": "index.d.ts",
|
|
13
13
|
"dependencies": {
|
|
14
|
-
"@casual-simulation/chalk": "^3.1.
|
|
14
|
+
"@casual-simulation/chalk": "^3.1.11",
|
|
15
15
|
"@jest/types": "^27.2.5"
|
|
16
16
|
},
|
|
17
17
|
"devDependencies": {
|
|
@@ -31,5 +31,5 @@
|
|
|
31
31
|
"publishConfig": {
|
|
32
32
|
"access": "public"
|
|
33
33
|
},
|
|
34
|
-
"gitHead": "
|
|
34
|
+
"gitHead": "c87563a9ccb65ba78215d9aeda438507a131c352"
|
|
35
35
|
}
|
package/src/diff/types.d.ts
CHANGED
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
import type { CompareKeys } from '../pretty-format';
|
|
8
|
-
export
|
|
9
|
-
export
|
|
8
|
+
export type DiffOptionsColor = (arg: string) => string;
|
|
9
|
+
export type DiffOptions = {
|
|
10
10
|
aAnnotation?: string;
|
|
11
11
|
aColor?: DiffOptionsColor;
|
|
12
12
|
aIndicator?: string;
|
|
@@ -26,7 +26,7 @@ export declare type DiffOptions = {
|
|
|
26
26
|
patchColor?: DiffOptionsColor;
|
|
27
27
|
compareKeys?: CompareKeys;
|
|
28
28
|
};
|
|
29
|
-
export
|
|
29
|
+
export type DiffOptionsNormalized = {
|
|
30
30
|
aAnnotation: string;
|
|
31
31
|
aColor: DiffOptionsColor;
|
|
32
32
|
aIndicator: string;
|
|
@@ -5,12 +5,12 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
8
|
-
|
|
8
|
+
type IsCommon = (aIndex: number, // caller can assume: 0 <= aIndex && aIndex < aLength
|
|
9
9
|
bIndex: number) => boolean;
|
|
10
|
-
|
|
10
|
+
type FoundSubsequence = (nCommon: number, // caller can assume: 0 < nCommon
|
|
11
11
|
aCommon: number, // caller can assume: 0 <= aCommon && aCommon < aLength
|
|
12
12
|
bCommon: number) => void;
|
|
13
|
-
export
|
|
13
|
+
export type Callbacks = {
|
|
14
14
|
foundSubsequence: FoundSubsequence;
|
|
15
15
|
isCommon: IsCommon;
|
|
16
16
|
};
|
package/src/get-type/index.d.ts
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* This source code is licensed under the MIT license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
|
-
|
|
7
|
+
type ValueType = 'array' | 'bigint' | 'boolean' | 'function' | 'null' | 'number' | 'object' | 'regexp' | 'map' | 'set' | 'date' | 'string' | 'symbol' | 'undefined';
|
|
8
8
|
export declare function getType(value: unknown): ValueType;
|
|
9
9
|
export declare const isPrimitive: (value: unknown) => boolean;
|
|
10
10
|
export {};
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* This source code is licensed under the MIT license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
|
-
|
|
7
|
+
type ReplaceableForEachCallBack = (value: unknown, key: unknown, object: unknown) => void;
|
|
8
8
|
export default class Replaceable {
|
|
9
9
|
object: any;
|
|
10
10
|
type: string;
|
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
import { DiffOptions as ImportDiffOptions } from '../diff';
|
|
8
|
-
|
|
9
|
-
export
|
|
8
|
+
type MatcherHintColor = (arg: string) => string;
|
|
9
|
+
export type MatcherHintOptions = {
|
|
10
10
|
comment?: string;
|
|
11
11
|
expectedColor?: MatcherHintColor;
|
|
12
12
|
isDirectExpectCall?: boolean;
|
|
@@ -16,7 +16,7 @@ export declare type MatcherHintOptions = {
|
|
|
16
16
|
secondArgument?: string;
|
|
17
17
|
secondArgumentColor?: MatcherHintColor;
|
|
18
18
|
};
|
|
19
|
-
export
|
|
19
|
+
export type DiffOptions = ImportDiffOptions;
|
|
20
20
|
export declare const EXPECTED_COLOR: import("@casual-simulation/chalk").ChalkInstance;
|
|
21
21
|
export declare const RECEIVED_COLOR: import("@casual-simulation/chalk").ChalkInstance;
|
|
22
22
|
export declare const INVERTED_COLOR: import("@casual-simulation/chalk").ChalkInstance;
|
|
@@ -45,7 +45,7 @@ export declare const ensureExpectedIsNonNegativeInteger: (expected: unknown, mat
|
|
|
45
45
|
export declare const printDiffOrStringify: (expected: unknown, received: unknown, expectedLabel: string, receivedLabel: string, expand: boolean) => string;
|
|
46
46
|
export declare const diff: (a: unknown, b: unknown, options?: DiffOptions) => string | null;
|
|
47
47
|
export declare const pluralize: (word: string, count: number) => string;
|
|
48
|
-
|
|
48
|
+
type PrintLabel = (string: string) => string;
|
|
49
49
|
export declare const getLabelPrinter: (...strings: Array<string>) => PrintLabel;
|
|
50
50
|
export declare const matcherErrorMessage: (hint: string, generic: string, specific?: string) => string;
|
|
51
51
|
export declare const matcherHint: (matcherName: string, received?: string, expected?: string, options?: MatcherHintOptions) => string;
|
|
@@ -5,13 +5,13 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
import type { NewPlugin } from '../types';
|
|
8
|
-
export
|
|
8
|
+
export type ReactTestObject = {
|
|
9
9
|
$$typeof: symbol;
|
|
10
10
|
type: string;
|
|
11
11
|
props?: Record<string, unknown>;
|
|
12
12
|
children?: null | Array<ReactTestChild>;
|
|
13
13
|
};
|
|
14
|
-
|
|
14
|
+
type ReactTestChild = ReactTestObject | string | number;
|
|
15
15
|
export declare const serialize: NewPlugin['serialize'];
|
|
16
16
|
export declare const test: NewPlugin['test'];
|
|
17
17
|
declare const plugin: NewPlugin;
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* This source code is licensed under the MIT license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
|
-
export
|
|
7
|
+
export type Colors = {
|
|
8
8
|
comment: {
|
|
9
9
|
close: string;
|
|
10
10
|
open: string;
|
|
@@ -26,25 +26,25 @@ export declare type Colors = {
|
|
|
26
26
|
open: string;
|
|
27
27
|
};
|
|
28
28
|
};
|
|
29
|
-
|
|
30
|
-
export
|
|
31
|
-
|
|
32
|
-
export
|
|
29
|
+
type Indent = (arg0: string) => string;
|
|
30
|
+
export type Refs = Array<unknown>;
|
|
31
|
+
type Print = (arg0: unknown) => string;
|
|
32
|
+
export type Theme = {
|
|
33
33
|
comment: string;
|
|
34
34
|
content: string;
|
|
35
35
|
prop: string;
|
|
36
36
|
tag: string;
|
|
37
37
|
value: string;
|
|
38
38
|
};
|
|
39
|
-
|
|
39
|
+
type ThemeReceived = {
|
|
40
40
|
comment?: string;
|
|
41
41
|
content?: string;
|
|
42
42
|
prop?: string;
|
|
43
43
|
tag?: string;
|
|
44
44
|
value?: string;
|
|
45
45
|
};
|
|
46
|
-
export
|
|
47
|
-
export
|
|
46
|
+
export type CompareKeys = ((a: string, b: string) => number) | undefined;
|
|
47
|
+
export type Options = {
|
|
48
48
|
callToJSON: boolean;
|
|
49
49
|
compareKeys: CompareKeys;
|
|
50
50
|
escapeRegex: boolean;
|
|
@@ -72,8 +72,8 @@ export interface PrettyFormatOptions {
|
|
|
72
72
|
printFunctionName?: boolean;
|
|
73
73
|
theme?: ThemeReceived;
|
|
74
74
|
}
|
|
75
|
-
export
|
|
76
|
-
export
|
|
75
|
+
export type OptionsReceived = PrettyFormatOptions;
|
|
76
|
+
export type Config = {
|
|
77
77
|
callToJSON: boolean;
|
|
78
78
|
compareKeys: CompareKeys;
|
|
79
79
|
colors: Colors;
|
|
@@ -88,22 +88,22 @@ export declare type Config = {
|
|
|
88
88
|
spacingInner: string;
|
|
89
89
|
spacingOuter: string;
|
|
90
90
|
};
|
|
91
|
-
export
|
|
92
|
-
|
|
93
|
-
export
|
|
91
|
+
export type Printer = (val: unknown, config: Config, indentation: string, depth: number, refs: Refs, hasCalledToJSON?: boolean) => string;
|
|
92
|
+
type Test = (arg0: any) => boolean;
|
|
93
|
+
export type NewPlugin = {
|
|
94
94
|
serialize: (val: any, config: Config, indentation: string, depth: number, refs: Refs, printer: Printer) => string;
|
|
95
95
|
test: Test;
|
|
96
96
|
};
|
|
97
|
-
|
|
97
|
+
type PluginOptions = {
|
|
98
98
|
edgeSpacing: string;
|
|
99
99
|
min: boolean;
|
|
100
100
|
spacing: string;
|
|
101
101
|
};
|
|
102
|
-
export
|
|
102
|
+
export type OldPlugin = {
|
|
103
103
|
print: (val: unknown, print: Print, indent: Indent, options: PluginOptions, colors: Colors) => string;
|
|
104
104
|
test: Test;
|
|
105
105
|
};
|
|
106
|
-
export
|
|
107
|
-
export
|
|
106
|
+
export type Plugin = NewPlugin | OldPlugin;
|
|
107
|
+
export type Plugins = Array<Plugin>;
|
|
108
108
|
export {};
|
|
109
109
|
//# sourceMappingURL=types.d.ts.map
|
package/src/types.d.ts
CHANGED
|
@@ -8,20 +8,20 @@
|
|
|
8
8
|
import type { Config } from '@jest/types';
|
|
9
9
|
import type * as jestMatcherUtils from './matcher-utils';
|
|
10
10
|
import { INTERNAL_MATCHER_FLAG } from './jestMatchersObject';
|
|
11
|
-
export
|
|
11
|
+
export type SyncExpectationResult = {
|
|
12
12
|
pass: boolean;
|
|
13
13
|
message: () => string;
|
|
14
14
|
};
|
|
15
|
-
export
|
|
16
|
-
export
|
|
17
|
-
export
|
|
15
|
+
export type AsyncExpectationResult = Promise<SyncExpectationResult>;
|
|
16
|
+
export type ExpectationResult = SyncExpectationResult | AsyncExpectationResult;
|
|
17
|
+
export type RawMatcherFn<T extends MatcherState = MatcherState> = {
|
|
18
18
|
(this: T, received: any, expected: any, options?: any): ExpectationResult;
|
|
19
19
|
[INTERNAL_MATCHER_FLAG]?: boolean;
|
|
20
20
|
};
|
|
21
|
-
export
|
|
22
|
-
export
|
|
23
|
-
export
|
|
24
|
-
export
|
|
21
|
+
export type ThrowingMatcherFn = (actual: any) => void;
|
|
22
|
+
export type PromiseMatcherFn = (actual: any) => Promise<void>;
|
|
23
|
+
export type Tester = (a: any, b: any) => boolean | undefined;
|
|
24
|
+
export type MatcherState = {
|
|
25
25
|
assertionCalls: number;
|
|
26
26
|
currentTestName?: string;
|
|
27
27
|
dontThrow?: () => void;
|
|
@@ -47,10 +47,10 @@ export interface AsymmetricMatcher {
|
|
|
47
47
|
getExpectedType?(): string;
|
|
48
48
|
toAsymmetricMatcher?(): string;
|
|
49
49
|
}
|
|
50
|
-
export
|
|
50
|
+
export type MatchersObject<T extends MatcherState = MatcherState> = {
|
|
51
51
|
[id: string]: RawMatcherFn<T>;
|
|
52
52
|
};
|
|
53
|
-
export
|
|
53
|
+
export type ExpectedAssertionsErrors = Array<{
|
|
54
54
|
actual: string | number;
|
|
55
55
|
error: Error;
|
|
56
56
|
expected: string;
|
|
@@ -63,7 +63,7 @@ interface AsymmetricMatchers {
|
|
|
63
63
|
stringContaining(sample: string): AsymmetricMatcher;
|
|
64
64
|
stringMatching(sample: string | RegExp): AsymmetricMatcher;
|
|
65
65
|
}
|
|
66
|
-
export
|
|
66
|
+
export type Expect<State extends MatcherState = MatcherState> = {
|
|
67
67
|
<T = unknown>(actual: T): Matchers<void, T>;
|
|
68
68
|
addSnapshotSerializer(serializer: unknown): void;
|
|
69
69
|
assertions(numberOfAssertions: number): void;
|