Skip to content

Commit 60bfb01

Browse files
chrisbobbegnprice
authored andcommitted
jest libdef [nfc]: Realign with upstream formatting, before updating to 27
When we took this libdef, it looks like we applied our Prettier formatting to it. Undo that. Done by pulling the 26 libdef afresh and - reapplying our patches to it - reverting small but substantive updates from upstream (we'll take those next, before moving to 27)
1 parent 75ba983 commit 60bfb01

File tree

1 file changed

+85
-33
lines changed

1 file changed

+85
-33
lines changed

flow-typed/jest_v26.x.x.js

Lines changed: 85 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
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
33

44
type JestMockFn<TArguments: $ReadOnlyArray<*>, TReturn> = {
55
(...args: TArguments): TReturn,
@@ -54,13 +54,17 @@ type JestMockFn<TArguments: $ReadOnlyArray<*>, TReturn> = {
5454
* that come from itself -- the only difference is that the implementation
5555
* will also be executed when the mock is called.
5656
*/
57-
mockImplementation(fn: (...args: TArguments) => TReturn): JestMockFn<TArguments, TReturn>,
57+
mockImplementation(
58+
fn: (...args: TArguments) => TReturn
59+
): JestMockFn<TArguments, TReturn>,
5860
/**
5961
* Accepts a function that will be used as an implementation of the mock for
6062
* one call to the mocked function. Can be chained so that multiple function
6163
* calls produce different results.
6264
*/
63-
mockImplementationOnce(fn: (...args: TArguments) => TReturn): JestMockFn<TArguments, TReturn>,
65+
mockImplementationOnce(
66+
fn: (...args: TArguments) => TReturn
67+
): JestMockFn<TArguments, TReturn>,
6468
/**
6569
* Accepts a string to use in test result output in place of "jest.fn()" to
6670
* indicate which mock function is being referenced.
@@ -85,7 +89,9 @@ type JestMockFn<TArguments: $ReadOnlyArray<*>, TReturn> = {
8589
/**
8690
* Sugar for jest.fn().mockImplementationOnce(() => Promise.resolve(value))
8791
*/
88-
mockResolvedValueOnce(value: TReturn): JestMockFn<TArguments, Promise<TReturn>>,
92+
mockResolvedValueOnce(
93+
value: TReturn
94+
): JestMockFn<TArguments, Promise<TReturn>>,
8995
/**
9096
* Sugar for jest.fn().mockImplementation(() => Promise.reject(value))
9197
*/
@@ -176,7 +182,7 @@ type JestStyledComponentsMatchersType = {
176182
toHaveStyleRule(
177183
property: string,
178184
value: JestStyledComponentsMatcherValue,
179-
options?: JestStyledComponentsMatcherOptions,
185+
options?: JestStyledComponentsMatcherOptions
180186
): void,
181187
...
182188
};
@@ -199,17 +205,20 @@ type EnzymeMatchersType = {
199205
toExist(): void,
200206
toHaveClassName(className: string): void,
201207
toHaveHTML(html: string): void,
202-
toHaveProp: ((propKey: string, propValue?: any) => void) & ((props: { ... }) => void),
208+
toHaveProp: ((propKey: string, propValue?: any) => void) &
209+
((props: { ... }) => void),
203210
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),
206215
toHaveTagName(tagName: string): void,
207216
toHaveText(text: string): void,
208217
toHaveValue(value: any): void,
209218
toIncludeText(text: string): void,
210219
toMatchElement(
211220
element: React$Element<any>,
212-
options?: {| ignoreProps?: boolean, verbose?: boolean |},
221+
options?: {| ignoreProps?: boolean, verbose?: boolean |}
213222
): void,
214223
toMatchSelector(selector: string): void,
215224
// 7.x
@@ -241,7 +250,10 @@ type DomTestingLibraryType = {
241250
toHaveFocus(): void,
242251
toHaveFormValues(expectedValues: {| [name: string]: any |}): void,
243252
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,
245257
toHaveValue(value?: string | string[] | number): void,
246258

247259
// 5.x
@@ -555,7 +567,7 @@ type SnapshotDiffType = {
555567
aAnnotation?: string,
556568
bAnnotation?: string,
557569
|},
558-
testName?: string,
570+
testName?: string
559571
): void,
560572
...
561573
};
@@ -809,7 +821,7 @@ type JestObjectType = {
809821
* implementation.
810822
*/
811823
fn<TArguments: $ReadOnlyArray<*>, TReturn>(
812-
implementation?: (...args: TArguments) => TReturn,
824+
implementation?: (...args: TArguments) => TReturn
813825
): JestMockFn<TArguments, TReturn>,
814826
/**
815827
* Determines if the given function is a mocked function.
@@ -829,7 +841,11 @@ type JestObjectType = {
829841
* The third argument can be used to create virtual mocks -- mocks of modules
830842
* that don't exist anywhere in the system.
831843
*/
832-
mock(moduleName: string, moduleFactory?: any, options?: Object): JestObjectType,
844+
mock(
845+
moduleName: string,
846+
moduleFactory?: any,
847+
options?: Object
848+
): JestObjectType,
833849
/**
834850
* Returns the actual module instead of a mock, bypassing all checks on
835851
* whether the module should receive a mock implementation or not.
@@ -929,7 +945,11 @@ type JestObjectType = {
929945
* Creates a mock function similar to jest.fn but also tracks calls to
930946
* object[methodName].
931947
*/
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>,
933953
/**
934954
* Set the default timeout interval for tests and before/after hooks in milliseconds.
935955
* Note: The default timeout interval is 5 seconds if this method is not called.
@@ -946,13 +966,25 @@ type JestDoneFn = {|
946966
|};
947967

948968
/** 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;
950973
/** 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;
952978
/** 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;
954983
/** 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;
956988

957989
/** A context for grouping tests together */
958990
declare var describe: {
@@ -975,7 +1007,11 @@ declare var describe: {
9751007
*/
9761008
each(
9771009
...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,
9791015
...
9801016
};
9811017

@@ -988,7 +1024,11 @@ declare var it: {
9881024
* @param {Function} Test
9891025
* @param {number} Timeout for the test, in milliseconds.
9901026
*/
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,
9921032
/**
9931033
* Only run this test
9941034
*
@@ -997,13 +1037,17 @@ declare var it: {
9971037
* @param {number} Timeout for the test, in milliseconds.
9981038
*/
9991039
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,
10011045
each(
10021046
...table: Array<Array<mixed> | mixed> | [Array<string>, string]
10031047
): (
10041048
name: JestTestName,
10051049
fn?: (...args: Array<any>) => ?Promise<mixed>,
1006-
timeout?: number,
1050+
timeout?: number
10071051
) => void,
10081052
|},
10091053
/**
@@ -1013,7 +1057,11 @@ declare var it: {
10131057
* @param {Function} Test
10141058
* @param {number} Timeout for the test, in milliseconds.
10151059
*/
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,
10171065
/**
10181066
* Highlight planned tests in the summary output
10191067
*
@@ -1030,7 +1078,7 @@ declare var it: {
10301078
concurrent(
10311079
name: JestTestName,
10321080
fn?: (done: JestDoneFn) => ?Promise<mixed>,
1033-
timeout?: number,
1081+
timeout?: number
10341082
): void,
10351083
/**
10361084
* each runs this test against array of argument arrays per each run
@@ -1039,14 +1087,18 @@ declare var it: {
10391087
*/
10401088
each(
10411089
...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,
10431095
...
10441096
};
10451097

10461098
declare function fit(
10471099
name: JestTestName,
10481100
fn: (done: JestDoneFn) => ?Promise<mixed>,
1049-
timeout?: number,
1101+
timeout?: number
10501102
): void;
10511103
/** An individual test unit */
10521104
declare var test: typeof it;
@@ -1088,9 +1140,9 @@ type JestPrettyFormatColors = {
10881140
...
10891141
};
10901142

1091-
type JestPrettyFormatIndent = string => string;
1143+
type JestPrettyFormatIndent = (string) => string;
10921144
type JestPrettyFormatRefs = Array<any>;
1093-
type JestPrettyFormatPrint = any => string;
1145+
type JestPrettyFormatPrint = (any) => string;
10941146
type JestPrettyFormatStringOrNull = string | null;
10951147

10961148
type JestPrettyFormatOptions = {|
@@ -1119,9 +1171,9 @@ type JestPrettyFormatPlugin = {
11191171
serialize: JestPrettyFormatPrint,
11201172
indent: JestPrettyFormatIndent,
11211173
opts: JestPrettyFormatOptions,
1122-
colors: JestPrettyFormatColors,
1174+
colors: JestPrettyFormatColors
11231175
) => string,
1124-
test: any => boolean,
1176+
test: (any) => boolean,
11251177
...
11261178
};
11271179

@@ -1131,7 +1183,7 @@ type JestPrettyFormatPlugins = Array<JestPrettyFormatPlugin>;
11311183
declare var expect: {
11321184
/** The object that you want to make assertions against */
11331185
(
1134-
value: any,
1186+
value: any
11351187
): JestExpectType &
11361188
JestPromiseType &
11371189
EnzymeMatchersType &
@@ -1183,7 +1235,7 @@ declare var jasmine: {
11831235
createSpy(name: string): JestSpyType,
11841236
createSpyObj(
11851237
baseName: string,
1186-
methodNames: Array<string>,
1238+
methodNames: Array<string>
11871239
): {| [methodName: string]: JestSpyType |},
11881240
objectContaining(value: Object): Object,
11891241
stringMatching(value: string): string,

0 commit comments

Comments
 (0)