1
- // flow-typed signature: e60c7806ec0ddaf4588f438843ef37bd
2
- // flow-typed version: 7afca48d86 /jest_v26.x.x/flow_>=v0.104 .x
1
+ // flow-typed signature: ec1949e99980c0b12113832818d455c9
2
+ // flow-typed version: 644a595e77 /jest_v26.x.x/flow_>=v0.134 .x
3
3
4
4
type JestMockFn < TArguments : $ReadOnlyArray < * > , TReturn > = {
5
5
( ...args : TArguments ) : TReturn ,
@@ -54,13 +54,17 @@ type JestMockFn<TArguments: $ReadOnlyArray<*>, TReturn> = {
54
54
* that come from itself -- the only difference is that the implementation
55
55
* will also be executed when the mock is called.
56
56
*/
57
- mockImplementation ( fn : ( ...args : TArguments ) = > TReturn ) : JestMockFn < TArguments , TReturn > ,
57
+ mockImplementation (
58
+ fn : ( ...args : TArguments ) = > TReturn
59
+ ) : JestMockFn < TArguments , TReturn > ,
58
60
/**
59
61
* Accepts a function that will be used as an implementation of the mock for
60
62
* one call to the mocked function. Can be chained so that multiple function
61
63
* calls produce different results.
62
64
*/
63
- mockImplementationOnce ( fn : ( ...args : TArguments ) = > TReturn ) : JestMockFn < TArguments , TReturn > ,
65
+ mockImplementationOnce (
66
+ fn : ( ...args : TArguments ) = > TReturn
67
+ ) : JestMockFn < TArguments , TReturn > ,
64
68
/**
65
69
* Accepts a string to use in test result output in place of "jest.fn()" to
66
70
* indicate which mock function is being referenced.
@@ -85,7 +89,9 @@ type JestMockFn<TArguments: $ReadOnlyArray<*>, TReturn> = {
85
89
/**
86
90
* Sugar for jest.fn().mockImplementationOnce(() => Promise.resolve(value))
87
91
*/
88
- mockResolvedValueOnce ( value : TReturn ) : JestMockFn < TArguments , Promise < TReturn >> ,
92
+ mockResolvedValueOnce (
93
+ value : TReturn
94
+ ) : JestMockFn < TArguments , Promise < TReturn >> ,
89
95
/**
90
96
* Sugar for jest.fn().mockImplementation(() => Promise.reject(value))
91
97
*/
@@ -176,7 +182,7 @@ type JestStyledComponentsMatchersType = {
176
182
toHaveStyleRule (
177
183
property : string ,
178
184
value : JestStyledComponentsMatcherValue ,
179
- options ?: JestStyledComponentsMatcherOptions ,
185
+ options ?: JestStyledComponentsMatcherOptions
180
186
) : void ,
181
187
...
182
188
} ;
@@ -199,17 +205,20 @@ type EnzymeMatchersType = {
199
205
toExist ( ) : void ,
200
206
toHaveClassName ( className : string ) : void ,
201
207
toHaveHTML ( html : string ) : void ,
202
- toHaveProp : ( ( propKey : string , propValue ? : any ) => void ) & ( ( props : { ... } ) => void ) ,
208
+ toHaveProp : ( ( propKey : string , propValue ? : any ) => void ) &
209
+ ( ( props : { ... } ) => void ) ,
203
210
toHaveRef ( refName : string ) : void ,
204
- toHaveState : ( ( stateKey : string , stateValue ? : any ) => void ) & ( ( state : { ... } ) => void ) ,
205
- toHaveStyle : ( ( styleKey : string , styleValue ? : any ) => void ) & ( ( style : { ... } ) => void ) ,
211
+ toHaveState : ( ( stateKey : string , stateValue ? : any ) => void ) &
212
+ ( ( state : { ... } ) => void ) ,
213
+ toHaveStyle : ( ( styleKey : string , styleValue ? : any ) => void ) &
214
+ ( ( style : { ... } ) => void ) ,
206
215
toHaveTagName ( tagName : string ) : void ,
207
216
toHaveText ( text : string ) : void ,
208
217
toHaveValue ( value : any ) : void ,
209
218
toIncludeText ( text : string ) : void ,
210
219
toMatchElement (
211
220
element : React$Element < any > ,
212
- options ?: { | ignoreProps ?: boolean , verbose ?: boolean | } ,
221
+ options ?: { | ignoreProps ?: boolean , verbose ?: boolean | }
213
222
) : void ,
214
223
toMatchSelector ( selector : string ) : void ,
215
224
// 7.x
@@ -241,7 +250,10 @@ type DomTestingLibraryType = {
241
250
toHaveFocus ( ) : void ,
242
251
toHaveFormValues ( expectedValues : { | [ name : string ] : any | } ) : void ,
243
252
toHaveStyle ( css : string | { | [ name : string ] : any | } ) : void ,
244
- toHaveTextContent ( text : string | RegExp , options ?: { | normalizeWhitespace : boolean | } ) : void ,
253
+ toHaveTextContent (
254
+ text : string | RegExp ,
255
+ options ?: { | normalizeWhitespace : boolean | }
256
+ ) : void ,
245
257
toHaveValue ( value ?: string | string [ ] | number ) : void ,
246
258
247
259
// 5.x
@@ -555,7 +567,7 @@ type SnapshotDiffType = {
555
567
aAnnotation ?: string ,
556
568
bAnnotation ?: string ,
557
569
| } ,
558
- testName ?: string ,
570
+ testName ?: string
559
571
) : void ,
560
572
...
561
573
} ;
@@ -809,7 +821,7 @@ type JestObjectType = {
809
821
* implementation.
810
822
*/
811
823
fn < TArguments : $ReadOnlyArray < * > , TReturn > (
812
- implementation ?: ( ...args : TArguments ) => TReturn ,
824
+ implementation ?: ( ...args : TArguments ) => TReturn
813
825
) : JestMockFn < TArguments , TReturn > ,
814
826
/**
815
827
* Determines if the given function is a mocked function.
@@ -829,7 +841,11 @@ type JestObjectType = {
829
841
* The third argument can be used to create virtual mocks -- mocks of modules
830
842
* that don't exist anywhere in the system.
831
843
*/
832
- mock ( moduleName : string , moduleFactory ? : any , options ? : Object ) : JestObjectType ,
844
+ mock (
845
+ moduleName : string ,
846
+ moduleFactory ? : any ,
847
+ options ? : Object
848
+ ) : JestObjectType ,
833
849
/**
834
850
* Returns the actual module instead of a mock, bypassing all checks on
835
851
* whether the module should receive a mock implementation or not.
@@ -929,7 +945,11 @@ type JestObjectType = {
929
945
* Creates a mock function similar to jest.fn but also tracks calls to
930
946
* object[methodName].
931
947
*/
932
- spyOn ( object : Object , methodName : string , accessType ? : 'get' | 'set' ) : JestMockFn < any , any > ,
948
+ spyOn (
949
+ object : Object ,
950
+ methodName : string ,
951
+ accessType ? : 'get' | 'set'
952
+ ) : JestMockFn < any , any > ,
933
953
/**
934
954
* Set the default timeout interval for tests and before/after hooks in milliseconds.
935
955
* Note: The default timeout interval is 5 seconds if this method is not called.
@@ -946,13 +966,25 @@ type JestDoneFn = {|
946
966
| } ;
947
967
948
968
/** Runs this function after every test inside this context */
949
- declare function afterEach ( fn : ( done : JestDoneFn ) = > ?Promise < mixed > , timeout ?: number ) : void ;
969
+ declare function afterEach (
970
+ fn : ( done : JestDoneFn ) = > ?Promise < mixed > ,
971
+ timeout ?: number
972
+ ) : void ;
950
973
/** Runs this function before every test inside this context */
951
- declare function beforeEach ( fn : ( done : JestDoneFn ) = > ?Promise < mixed > , timeout ?: number ) : void ;
974
+ declare function beforeEach (
975
+ fn : ( done : JestDoneFn ) = > ?Promise < mixed > ,
976
+ timeout ?: number
977
+ ) : void ;
952
978
/** Runs this function after all tests have finished inside this context */
953
- declare function afterAll ( fn : ( done : JestDoneFn ) = > ?Promise < mixed > , timeout ?: number ) : void ;
979
+ declare function afterAll (
980
+ fn : ( done : JestDoneFn ) = > ?Promise < mixed > ,
981
+ timeout ?: number
982
+ ) : void ;
954
983
/** Runs this function before any tests have started inside this context */
955
- declare function beforeAll ( fn : ( done : JestDoneFn ) = > ?Promise < mixed > , timeout ?: number ) : void ;
984
+ declare function beforeAll (
985
+ fn : ( done : JestDoneFn ) = > ?Promise < mixed > ,
986
+ timeout ?: number
987
+ ) : void ;
956
988
957
989
/** A context for grouping tests together */
958
990
declare var describe : {
@@ -975,7 +1007,11 @@ declare var describe: {
975
1007
*/
976
1008
each (
977
1009
...table : Array < Array < mixed > | mixed > | [ Array < string > , string ]
978
- ) : ( name : JestTestName , fn ?: ( ...args : Array < any > ) => ?Promise < mixed > , timeout ?: number ) => void ,
1010
+ ) : (
1011
+ name : JestTestName ,
1012
+ fn ?: ( ...args : Array < any > ) => ?Promise < mixed > ,
1013
+ timeout ?: number
1014
+ ) => void ,
979
1015
...
980
1016
} ;
981
1017
@@ -988,7 +1024,11 @@ declare var it: {
988
1024
* @param {Function } Test
989
1025
* @param {number } Timeout for the test, in milliseconds.
990
1026
*/
991
- ( name : JestTestName , fn ?: ( done : JestDoneFn ) => ?Promise < mixed > , timeout ?: number ) : void ,
1027
+ (
1028
+ name : JestTestName ,
1029
+ fn ?: ( done : JestDoneFn ) => ?Promise < mixed > ,
1030
+ timeout ?: number
1031
+ ) : void ,
992
1032
/**
993
1033
* Only run this test
994
1034
*
@@ -997,13 +1037,17 @@ declare var it: {
997
1037
* @param {number } Timeout for the test, in milliseconds.
998
1038
*/
999
1039
only : { |
1000
- ( name : JestTestName , fn ?: ( done : JestDoneFn ) => ?Promise < mixed > , timeout ?: number ) : void ,
1040
+ (
1041
+ name : JestTestName ,
1042
+ fn ?: ( done : JestDoneFn ) => ?Promise < mixed > ,
1043
+ timeout ?: number
1044
+ ) : void ,
1001
1045
each (
1002
1046
...table : Array < Array < mixed > | mixed > | [ Array < string > , string ]
1003
1047
) : (
1004
1048
name : JestTestName ,
1005
1049
fn ?: ( ...args : Array < any > ) => ?Promise < mixed > ,
1006
- timeout ?: number ,
1050
+ timeout ?: number
1007
1051
) => void ,
1008
1052
| } ,
1009
1053
/**
@@ -1013,7 +1057,11 @@ declare var it: {
1013
1057
* @param {Function } Test
1014
1058
* @param {number } Timeout for the test, in milliseconds.
1015
1059
*/
1016
- skip ( name : JestTestName , fn ?: ( done : JestDoneFn ) => ?Promise < mixed > , timeout ?: number ) : void ,
1060
+ skip (
1061
+ name : JestTestName ,
1062
+ fn ?: ( done : JestDoneFn ) => ?Promise < mixed > ,
1063
+ timeout ?: number
1064
+ ) : void ,
1017
1065
/**
1018
1066
* Highlight planned tests in the summary output
1019
1067
*
@@ -1030,7 +1078,7 @@ declare var it: {
1030
1078
concurrent (
1031
1079
name : JestTestName ,
1032
1080
fn ?: ( done : JestDoneFn ) => ?Promise < mixed > ,
1033
- timeout ?: number ,
1081
+ timeout ?: number
1034
1082
) : void ,
1035
1083
/**
1036
1084
* each runs this test against array of argument arrays per each run
@@ -1039,14 +1087,18 @@ declare var it: {
1039
1087
*/
1040
1088
each (
1041
1089
...table : Array < Array < mixed > | mixed > | [ Array < string > , string ]
1042
- ) : ( name : JestTestName , fn ?: ( ...args : Array < any > ) => ?Promise < mixed > , timeout ?: number ) = > void ,
1090
+ ) : (
1091
+ name : JestTestName ,
1092
+ fn ?: ( ...args : Array < any > ) => ?Promise < mixed > ,
1093
+ timeout ?: number
1094
+ ) = > void ,
1043
1095
...
1044
1096
} ;
1045
1097
1046
1098
declare function fit (
1047
1099
name : JestTestName ,
1048
1100
fn : ( done : JestDoneFn ) = > ?Promise < mixed > ,
1049
- timeout ?: number ,
1101
+ timeout ?: number
1050
1102
) : void ;
1051
1103
/** An individual test unit */
1052
1104
declare var test : typeof it ;
@@ -1088,9 +1140,9 @@ type JestPrettyFormatColors = {
1088
1140
...
1089
1141
} ;
1090
1142
1091
- type JestPrettyFormatIndent = string => string ;
1143
+ type JestPrettyFormatIndent = ( string ) => string ;
1092
1144
type JestPrettyFormatRefs = Array < any > ;
1093
- type JestPrettyFormatPrint = any => string ;
1145
+ type JestPrettyFormatPrint = ( any ) => string ;
1094
1146
type JestPrettyFormatStringOrNull = string | null ;
1095
1147
1096
1148
type JestPrettyFormatOptions = { |
@@ -1119,9 +1171,9 @@ type JestPrettyFormatPlugin = {
1119
1171
serialize : JestPrettyFormatPrint ,
1120
1172
indent : JestPrettyFormatIndent ,
1121
1173
opts : JestPrettyFormatOptions ,
1122
- colors : JestPrettyFormatColors ,
1174
+ colors : JestPrettyFormatColors
1123
1175
) => string ,
1124
- test : any => boolean ,
1176
+ test : ( any ) => boolean ,
1125
1177
...
1126
1178
} ;
1127
1179
@@ -1131,7 +1183,7 @@ type JestPrettyFormatPlugins = Array<JestPrettyFormatPlugin>;
1131
1183
declare var expect : {
1132
1184
/** The object that you want to make assertions against */
1133
1185
(
1134
- value : any ,
1186
+ value : any
1135
1187
) : JestExpectType &
1136
1188
JestPromiseType &
1137
1189
EnzymeMatchersType &
@@ -1183,7 +1235,7 @@ declare var jasmine: {
1183
1235
createSpy ( name : string ) : JestSpyType ,
1184
1236
createSpyObj (
1185
1237
baseName : string ,
1186
- methodNames : Array < string > ,
1238
+ methodNames : Array < string >
1187
1239
) : { | [ methodName : string ] : JestSpyType | } ,
1188
1240
objectContaining ( value : Object ) : Object ,
1189
1241
stringMatching ( value : string ) : string ,
0 commit comments