Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3401129
D10545.id35245.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
33 KB
Referenced Files
None
Subscribers
None
D10545.id35245.diff
View Options
diff --git a/keyserver/flow-typed/npm/jest_v26.x.x.js b/keyserver/flow-typed/npm/jest_v29.x.x.js
rename from keyserver/flow-typed/npm/jest_v26.x.x.js
rename to keyserver/flow-typed/npm/jest_v29.x.x.js
--- a/keyserver/flow-typed/npm/jest_v26.x.x.js
+++ b/keyserver/flow-typed/npm/jest_v29.x.x.js
@@ -1,7 +1,7 @@
-// flow-typed signature: ec1949e99980c0b12113832818d455c9
-// flow-typed version: 644a595e77/jest_v26.x.x/flow_>=v0.134.x
+// flow-typed signature: f3f75dec8a0c58e78c2a57e2f81e6f7f
+// flow-typed version: 00ecb7849a/jest_v29.x.x/flow_>=v0.201.x
-type JestMockFn<TArguments: $ReadOnlyArray<*>, TReturn> = {
+type JestMockFn<TArguments: $ReadOnlyArray<any>, TReturn> = {
(...args: TArguments): TReturn,
/**
* An object for introspecting mock calls
@@ -13,6 +13,12 @@
* passed during the call.
*/
calls: Array<TArguments>,
+ /**
+ * An array containing the call arguments of the last call that was made
+ * to this mock function. If the function was not called, it will return
+ * undefined.
+ */
+ lastCall: TArguments,
/**
* An array that contains all the object instances that have been
* instantiated from this mock function.
@@ -161,6 +167,32 @@
*/
type JestTestName = string | Function;
+type FakeableAPI =
+ | 'Date'
+ | 'hrtime'
+ | 'nextTick'
+ | 'performance'
+ | 'queueMicrotask'
+ | 'requestAnimationFrame'
+ | 'cancelAnimationFrame'
+ | 'requestIdleCallback'
+ | 'cancelIdleCallback'
+ | 'setImmediate'
+ | 'clearImmediate'
+ | 'setInterval'
+ | 'clearInterval'
+ | 'setTimeout'
+ | 'clearTimeout';
+
+type FakeTimersConfig = {
+ advanceTimers?: boolean | number,
+ doNotFake?: Array<FakeableAPI>,
+ now?: number | Date,
+ timerLimit?: number,
+ legacyFakeTimers?: boolean,
+ ...
+};
+
/**
* Plugin: jest-styled-components
*/
@@ -627,7 +659,7 @@
* Use .toBeInstanceOf(Class) to check that an object is an instance of a
* class.
*/
- toBeInstanceOf(cls: Class<*>): void;
+ toBeInstanceOf(cls: Class<any>): void;
/**
* .toBeNull() is the same as .toBe(null) but the error messages are a bit
* nicer.
@@ -826,7 +858,7 @@
* Returns a new, unused mock function. Optionally takes a mock
* implementation.
*/
- fn<TArguments: $ReadOnlyArray<*>, TReturn>(
+ fn<TArguments: $ReadOnlyArray<any>, TReturn>(
implementation?: (...args: TArguments) => TReturn
): JestMockFn<TArguments, TReturn>,
/**
@@ -896,13 +928,6 @@
* or setInterval() and setImmediate()).
*/
advanceTimersByTime(msToRun: number): void,
- /**
- * Executes only the macro task queue (i.e. all tasks queued by setTimeout()
- * or setInterval() and setImmediate()).
- *
- * Renamed to `advanceTimersByTime`.
- */
- runTimersToTime(msToRun: number): void,
/**
* Executes only the macro-tasks that are currently pending (i.e., only the
* tasks that have been queued by setTimeout() or setInterval() up to this
@@ -926,7 +951,7 @@
* (setTimeout, setInterval, clearTimeout, clearInterval, nextTick,
* setImmediate and clearImmediate).
*/
- useFakeTimers(mode?: 'modern' | 'legacy'): JestObjectType,
+ useFakeTimers(fakeTimersConfig?: FakeTimersConfig): JestObjectType,
/**
* Instructs Jest to use the real versions of the standard timer functions.
*/
@@ -1199,8 +1224,8 @@
hasAssertions(): void,
any(value: mixed): JestAsymmetricEqualityType,
anything(): any,
- arrayContaining(value: Array<mixed>): Array<mixed>,
- objectContaining(value: Object): Object,
+ arrayContaining(value: $ReadOnlyArray<mixed>): Array<mixed>,
+ objectContaining(value: { ... }): Object,
/** Matches any received string that contains the exact expected string. */
stringContaining(value: string): string,
stringMatching(value: string | RegExp): string,
diff --git a/lib/flow-typed/npm/jest_v26.x.x.js b/lib/flow-typed/npm/jest_v29.x.x.js
rename from lib/flow-typed/npm/jest_v26.x.x.js
rename to lib/flow-typed/npm/jest_v29.x.x.js
--- a/lib/flow-typed/npm/jest_v26.x.x.js
+++ b/lib/flow-typed/npm/jest_v29.x.x.js
@@ -1,7 +1,7 @@
-// flow-typed signature: ec1949e99980c0b12113832818d455c9
-// flow-typed version: 644a595e77/jest_v26.x.x/flow_>=v0.134.x
+// flow-typed signature: f3f75dec8a0c58e78c2a57e2f81e6f7f
+// flow-typed version: 00ecb7849a/jest_v29.x.x/flow_>=v0.201.x
-type JestMockFn<TArguments: $ReadOnlyArray<*>, TReturn> = {
+type JestMockFn<TArguments: $ReadOnlyArray<any>, TReturn> = {
(...args: TArguments): TReturn,
/**
* An object for introspecting mock calls
@@ -13,6 +13,12 @@
* passed during the call.
*/
calls: Array<TArguments>,
+ /**
+ * An array containing the call arguments of the last call that was made
+ * to this mock function. If the function was not called, it will return
+ * undefined.
+ */
+ lastCall: TArguments,
/**
* An array that contains all the object instances that have been
* instantiated from this mock function.
@@ -161,6 +167,32 @@
*/
type JestTestName = string | Function;
+type FakeableAPI =
+ | 'Date'
+ | 'hrtime'
+ | 'nextTick'
+ | 'performance'
+ | 'queueMicrotask'
+ | 'requestAnimationFrame'
+ | 'cancelAnimationFrame'
+ | 'requestIdleCallback'
+ | 'cancelIdleCallback'
+ | 'setImmediate'
+ | 'clearImmediate'
+ | 'setInterval'
+ | 'clearInterval'
+ | 'setTimeout'
+ | 'clearTimeout';
+
+type FakeTimersConfig = {
+ advanceTimers?: boolean | number,
+ doNotFake?: Array<FakeableAPI>,
+ now?: number | Date,
+ timerLimit?: number,
+ legacyFakeTimers?: boolean,
+ ...
+};
+
/**
* Plugin: jest-styled-components
*/
@@ -627,7 +659,7 @@
* Use .toBeInstanceOf(Class) to check that an object is an instance of a
* class.
*/
- toBeInstanceOf(cls: Class<*>): void;
+ toBeInstanceOf(cls: Class<any>): void;
/**
* .toBeNull() is the same as .toBe(null) but the error messages are a bit
* nicer.
@@ -826,7 +858,7 @@
* Returns a new, unused mock function. Optionally takes a mock
* implementation.
*/
- fn<TArguments: $ReadOnlyArray<*>, TReturn>(
+ fn<TArguments: $ReadOnlyArray<any>, TReturn>(
implementation?: (...args: TArguments) => TReturn
): JestMockFn<TArguments, TReturn>,
/**
@@ -896,13 +928,6 @@
* or setInterval() and setImmediate()).
*/
advanceTimersByTime(msToRun: number): void,
- /**
- * Executes only the macro task queue (i.e. all tasks queued by setTimeout()
- * or setInterval() and setImmediate()).
- *
- * Renamed to `advanceTimersByTime`.
- */
- runTimersToTime(msToRun: number): void,
/**
* Executes only the macro-tasks that are currently pending (i.e., only the
* tasks that have been queued by setTimeout() or setInterval() up to this
@@ -926,7 +951,7 @@
* (setTimeout, setInterval, clearTimeout, clearInterval, nextTick,
* setImmediate and clearImmediate).
*/
- useFakeTimers(mode?: 'modern' | 'legacy'): JestObjectType,
+ useFakeTimers(fakeTimersConfig?: FakeTimersConfig): JestObjectType,
/**
* Instructs Jest to use the real versions of the standard timer functions.
*/
@@ -1199,8 +1224,8 @@
hasAssertions(): void,
any(value: mixed): JestAsymmetricEqualityType,
anything(): any,
- arrayContaining(value: Array<mixed>): Array<mixed>,
- objectContaining(value: Object): Object,
+ arrayContaining(value: $ReadOnlyArray<mixed>): Array<mixed>,
+ objectContaining(value: { ... }): Object,
/** Matches any received string that contains the exact expected string. */
stringContaining(value: string): string,
stringMatching(value: string | RegExp): string,
diff --git a/native/flow-typed/npm/jest_v24.x.x.js b/native/flow-typed/npm/jest_v29.x.x.js
rename from native/flow-typed/npm/jest_v24.x.x.js
rename to native/flow-typed/npm/jest_v29.x.x.js
--- a/native/flow-typed/npm/jest_v24.x.x.js
+++ b/native/flow-typed/npm/jest_v29.x.x.js
@@ -1,7 +1,7 @@
-// flow-typed signature: ec5f209a3b2ff526e13bf59605e51e87
-// flow-typed version: 6cb9e99836/jest_v24.x.x/flow_>=v0.39.x <=v0.103.x
+// flow-typed signature: f3f75dec8a0c58e78c2a57e2f81e6f7f
+// flow-typed version: 00ecb7849a/jest_v29.x.x/flow_>=v0.201.x
-type JestMockFn<TArguments: $ReadOnlyArray<*>, TReturn> = {
+type JestMockFn<TArguments: $ReadOnlyArray<any>, TReturn> = {
(...args: TArguments): TReturn,
/**
* An object for introspecting mock calls
@@ -13,6 +13,12 @@
* passed during the call.
*/
calls: Array<TArguments>,
+ /**
+ * An array containing the call arguments of the last call that was made
+ * to this mock function. If the function was not called, it will return
+ * undefined.
+ */
+ lastCall: TArguments,
/**
* An array that contains all the object instances that have been
* instantiated from this mock function.
@@ -22,7 +28,12 @@
* An array that contains all the object results that have been
* returned by this mock function call
*/
- results: Array<{ isThrow: boolean, value: TReturn }>,
+ results: Array<{
+ isThrow: boolean,
+ value: TReturn,
+ ...
+ }>,
+ ...
},
/**
* Resets all information stored in the mockFn.mock.calls and
@@ -95,6 +106,7 @@
* Sugar for jest.fn().mockImplementationOnce(() => Promise.reject(value))
*/
mockRejectedValueOnce(value: TReturn): JestMockFn<TArguments, Promise<any>>,
+ ...
};
type JestAsymmetricEqualityType = {
@@ -102,6 +114,7 @@
* A custom Jasmine equality tester
*/
asymmetricMatch(value: mixed): boolean,
+ ...
};
type JestCallsType = {
@@ -112,6 +125,7 @@
first(): mixed,
mostRecent(): mixed,
reset(): void,
+ ...
};
type JestClockType = {
@@ -119,11 +133,13 @@
mockDate(date: Date): void,
tick(milliseconds?: number): void,
uninstall(): void,
+ ...
};
type JestMatcherResult = {
message?: string | (() => string),
pass: boolean,
+ ...
};
type JestMatcher = (
@@ -142,6 +158,7 @@
* matcher can be chained. If the promise is rejected the assertion fails.
*/
resolves: JestExpectType,
+ ...
};
/**
@@ -150,6 +167,32 @@
*/
type JestTestName = string | Function;
+type FakeableAPI =
+ | 'Date'
+ | 'hrtime'
+ | 'nextTick'
+ | 'performance'
+ | 'queueMicrotask'
+ | 'requestAnimationFrame'
+ | 'cancelAnimationFrame'
+ | 'requestIdleCallback'
+ | 'cancelIdleCallback'
+ | 'setImmediate'
+ | 'clearImmediate'
+ | 'setInterval'
+ | 'clearInterval'
+ | 'setTimeout'
+ | 'clearTimeout';
+
+type FakeTimersConfig = {
+ advanceTimers?: boolean | number,
+ doNotFake?: Array<FakeableAPI>,
+ now?: number | Date,
+ timerLimit?: number,
+ legacyFakeTimers?: boolean,
+ ...
+};
+
/**
* Plugin: jest-styled-components
*/
@@ -164,6 +207,7 @@
media?: string,
modifier?: string,
supports?: string,
+ ...
};
type JestStyledComponentsMatchersType = {
@@ -172,6 +216,7 @@
value: JestStyledComponentsMatcherValue,
options?: JestStyledComponentsMatcherOptions
): void,
+ ...
};
/**
@@ -193,12 +238,12 @@
toHaveClassName(className: string): void,
toHaveHTML(html: string): void,
toHaveProp: ((propKey: string, propValue?: any) => void) &
- ((props: {}) => void),
+ ((props: { ... }) => void),
toHaveRef(refName: string): void,
toHaveState: ((stateKey: string, stateValue?: any) => void) &
- ((state: {}) => void),
+ ((state: { ... }) => void),
toHaveStyle: ((styleKey: string, styleValue?: any) => void) &
- ((style: {}) => void),
+ ((style: { ... }) => void),
toHaveTagName(tagName: string): void,
toHaveText(text: string): void,
toHaveValue(value: any): void,
@@ -210,6 +255,7 @@
toMatchSelector(selector: string): void,
// 7.x
toHaveDisplayName(name: string): void,
+ ...
};
// DOM testing library extensions (jest-dom)
@@ -220,6 +266,7 @@
*/
toBeInTheDOM(container?: HTMLElement): void,
+ // 4.x
toBeInTheDocument(): void,
toBeVisible(): void,
toBeEmpty(): void,
@@ -233,13 +280,21 @@
toHaveAttribute(attr: string, value?: any): void,
toHaveClass(...classNames: string[]): void,
toHaveFocus(): void,
- toHaveFormValues(expectedValues: { [name: string]: any }): void,
- toHaveStyle(css: string): void,
+ toHaveFormValues(expectedValues: { [name: string]: any, ... }): void,
+ toHaveStyle(css: string | { [name: string]: any, ... }): void,
toHaveTextContent(
text: string | RegExp,
- options?: { normalizeWhitespace: boolean }
+ options?: {| normalizeWhitespace: boolean |}
): void,
toHaveValue(value?: string | string[] | number): void,
+
+ // 5.x
+ toHaveDisplayValue(value: string | string[]): void,
+ toBeChecked(): void,
+ toBeEmptyDOMElement(): void,
+ toBePartiallyChecked(): void,
+ toHaveDescription(text: string | RegExp): void,
+ ...
};
// Jest JQuery Matchers: https://github.com/unindented/custom-jquery-matchers
@@ -254,7 +309,7 @@
toHaveText(text: string | RegExp): void,
toHaveData(key: string, val?: any): void,
toHaveValue(val: any): void,
- toHaveCss(css: { [key: string]: any }): void,
+ toHaveCss(css: { [key: string]: any, ... }): void,
toBeChecked(): void,
toBeDisabled(): void,
toBeEmpty(): void,
@@ -266,6 +321,7 @@
toBeMatchedBy(sel: string): void,
toHaveDescendant(sel: string): void,
toHaveDescendantWithText(sel: string, text: string | RegExp): void,
+ ...
};
// Jest Extended Matchers: https://github.com/jest-community/jest-extended
@@ -290,78 +346,64 @@
* Use .toBeEmpty when checking if a String '', Array [] or Object {} is empty.
*/
toBeEmpty(): void,
-
/**
* Use .toBeOneOf when checking if a value is a member of a given Array.
* @param {Array.<*>} members
*/
toBeOneOf(members: any[]): void,
-
/**
* Use `.toBeNil` when checking a value is `null` or `undefined`.
*/
toBeNil(): void,
-
/**
* Use `.toSatisfy` when you want to use a custom matcher by supplying a predicate function that returns a `Boolean`.
* @param {Function} predicate
*/
toSatisfy(predicate: (n: any) => boolean): void,
-
/**
* Use `.toBeArray` when checking if a value is an `Array`.
*/
toBeArray(): void,
-
/**
* Use `.toBeArrayOfSize` when checking if a value is an `Array` of size x.
* @param {Number} x
*/
toBeArrayOfSize(x: number): void,
-
/**
* Use `.toIncludeAllMembers` when checking if an `Array` contains all of the same members of a given set.
* @param {Array.<*>} members
*/
toIncludeAllMembers(members: any[]): void,
-
/**
* Use `.toIncludeAnyMembers` when checking if an `Array` contains any of the members of a given set.
* @param {Array.<*>} members
*/
toIncludeAnyMembers(members: any[]): void,
-
/**
* Use `.toSatisfyAll` when you want to use a custom matcher by supplying a predicate function that returns a `Boolean` for all values in an array.
* @param {Function} predicate
*/
toSatisfyAll(predicate: (n: any) => boolean): void,
-
/**
* Use `.toBeBoolean` when checking if a value is a `Boolean`.
*/
toBeBoolean(): void,
-
/**
* Use `.toBeTrue` when checking a value is equal (===) to `true`.
*/
toBeTrue(): void,
-
/**
* Use `.toBeFalse` when checking a value is equal (===) to `false`.
*/
toBeFalse(): void,
-
/**
* Use .toBeDate when checking if a value is a Date.
*/
toBeDate(): void,
-
/**
* Use `.toBeFunction` when checking if a value is a `Function`.
*/
toBeFunction(): void,
-
/**
* Use `.toHaveBeenCalledBefore` when checking if a `Mock` was called before another `Mock`.
*
@@ -371,42 +413,34 @@
* @param {Mock} mock
*/
toHaveBeenCalledBefore(mock: JestMockFn<any, any>): void,
-
/**
* Use `.toBeNumber` when checking if a value is a `Number`.
*/
toBeNumber(): void,
-
/**
* Use `.toBeNaN` when checking a value is `NaN`.
*/
toBeNaN(): void,
-
/**
* Use `.toBeFinite` when checking if a value is a `Number`, not `NaN` or `Infinity`.
*/
toBeFinite(): void,
-
/**
* Use `.toBePositive` when checking if a value is a positive `Number`.
*/
toBePositive(): void,
-
/**
* Use `.toBeNegative` when checking if a value is a negative `Number`.
*/
toBeNegative(): void,
-
/**
* Use `.toBeEven` when checking if a value is an even `Number`.
*/
toBeEven(): void,
-
/**
* Use `.toBeOdd` when checking if a value is an odd `Number`.
*/
toBeOdd(): void,
-
/**
* Use `.toBeWithin` when checking if a number is in between the given bounds of: start (inclusive) and end (exclusive).
*
@@ -414,144 +448,122 @@
* @param {Number} end
*/
toBeWithin(start: number, end: number): void,
-
/**
* Use `.toBeObject` when checking if a value is an `Object`.
*/
toBeObject(): void,
-
/**
* Use `.toContainKey` when checking if an object contains the provided key.
*
* @param {String} key
*/
toContainKey(key: string): void,
-
/**
* Use `.toContainKeys` when checking if an object has all of the provided keys.
*
* @param {Array.<String>} keys
*/
toContainKeys(keys: string[]): void,
-
/**
* Use `.toContainAllKeys` when checking if an object only contains all of the provided keys.
*
* @param {Array.<String>} keys
*/
toContainAllKeys(keys: string[]): void,
-
/**
* Use `.toContainAnyKeys` when checking if an object contains at least one of the provided keys.
*
* @param {Array.<String>} keys
*/
toContainAnyKeys(keys: string[]): void,
-
/**
* Use `.toContainValue` when checking if an object contains the provided value.
*
* @param {*} value
*/
toContainValue(value: any): void,
-
/**
* Use `.toContainValues` when checking if an object contains all of the provided values.
*
* @param {Array.<*>} values
*/
toContainValues(values: any[]): void,
-
/**
* Use `.toContainAllValues` when checking if an object only contains all of the provided values.
*
* @param {Array.<*>} values
*/
toContainAllValues(values: any[]): void,
-
/**
* Use `.toContainAnyValues` when checking if an object contains at least one of the provided values.
*
* @param {Array.<*>} values
*/
toContainAnyValues(values: any[]): void,
-
/**
* Use `.toContainEntry` when checking if an object contains the provided entry.
*
* @param {Array.<String, String>} entry
*/
toContainEntry(entry: [string, string]): void,
-
/**
* Use `.toContainEntries` when checking if an object contains all of the provided entries.
*
* @param {Array.<Array.<String, String>>} entries
*/
toContainEntries(entries: [string, string][]): void,
-
/**
* Use `.toContainAllEntries` when checking if an object only contains all of the provided entries.
*
* @param {Array.<Array.<String, String>>} entries
*/
toContainAllEntries(entries: [string, string][]): void,
-
/**
* Use `.toContainAnyEntries` when checking if an object contains at least one of the provided entries.
*
* @param {Array.<Array.<String, String>>} entries
*/
toContainAnyEntries(entries: [string, string][]): void,
-
/**
* Use `.toBeExtensible` when checking if an object is extensible.
*/
toBeExtensible(): void,
-
/**
* Use `.toBeFrozen` when checking if an object is frozen.
*/
toBeFrozen(): void,
-
/**
* Use `.toBeSealed` when checking if an object is sealed.
*/
toBeSealed(): void,
-
/**
* Use `.toBeString` when checking if a value is a `String`.
*/
toBeString(): void,
-
/**
* Use `.toEqualCaseInsensitive` when checking if a string is equal (===) to another ignoring the casing of both strings.
*
* @param {String} string
*/
toEqualCaseInsensitive(string: string): void,
-
/**
* Use `.toStartWith` when checking if a `String` starts with a given `String` prefix.
*
* @param {String} prefix
*/
toStartWith(prefix: string): void,
-
/**
* Use `.toEndWith` when checking if a `String` ends with a given `String` suffix.
*
* @param {String} suffix
*/
toEndWith(suffix: string): void,
-
/**
* Use `.toInclude` when checking if a `String` includes the given `String` substring.
*
* @param {String} substring
*/
toInclude(substring: string): void,
-
/**
* Use `.toIncludeRepeated` when checking if a `String` includes the given `String` substring the correct number of times.
*
@@ -559,13 +571,35 @@
* @param {Number} times
*/
toIncludeRepeated(substring: string, times: number): void,
-
/**
* Use `.toIncludeMultiple` when checking if a `String` includes all of the given substrings.
*
* @param {Array.<String>} substring
*/
toIncludeMultiple(substring: string[]): void,
+ ...
+};
+
+// Diffing snapshot utility for Jest (snapshot-diff)
+// https://github.com/jest-community/snapshot-diff
+type SnapshotDiffType = {
+ /**
+ * Compare the difference between the actual in the `expect()`
+ * vs the object inside `valueB` with some extra options.
+ */
+ toMatchDiffSnapshot(
+ valueB: any,
+ options?: {|
+ expand?: boolean,
+ colors?: boolean,
+ contextLines?: number,
+ stablePatchmarks?: boolean,
+ aAnnotation?: string,
+ bAnnotation?: string,
+ |},
+ testName?: string
+ ): void,
+ ...
};
interface JestExpectType {
@@ -574,7 +608,8 @@
DomTestingLibraryType &
JestJQueryMatchersType &
JestStyledComponentsMatchersType &
- JestExtendedMatchersType;
+ JestExtendedMatchersType &
+ SnapshotDiffType;
/**
* If you have a mock function, you can use .lastCalledWith to test what
* arguments it was last called with.
@@ -624,7 +659,7 @@
* Use .toBeInstanceOf(Class) to check that an object is an instance of a
* class.
*/
- toBeInstanceOf(cls: Class<*>): void;
+ toBeInstanceOf(cls: Class<any>): void;
/**
* .toBeNull() is the same as .toBe(null) but the error messages are a bit
* nicer.
@@ -801,6 +836,14 @@
* Returns the number of fake timers still left to run.
*/
getTimerCount(): number,
+ /**
+ * Set the current system time used by fake timers.
+ * Simulates a user changing the system clock while your program is running.
+ * It affects the current time but it does not in itself cause
+ * e.g. timers to fire; they will fire exactly as they would have done
+ * without the call to jest.setSystemTime().
+ */
+ setSystemTime(now?: number | Date): void,
/**
* The same as `mock` but not moved to the top of the expectation by
* babel-jest.
@@ -815,18 +858,22 @@
* Returns a new, unused mock function. Optionally takes a mock
* implementation.
*/
- fn<TArguments: $ReadOnlyArray<*>, TReturn>(
+ fn<TArguments: $ReadOnlyArray<any>, TReturn>(
implementation?: (...args: TArguments) => TReturn
): JestMockFn<TArguments, TReturn>,
/**
* Determines if the given function is a mocked function.
*/
isMockFunction(fn: Function): boolean,
+ /**
+ * Alias of `createMockFromModule`.
+ */
+ genMockFromModule(moduleName: string): any,
/**
* Given the name of a module, use the automatic mocking system to generate a
* mocked version of the module for you.
*/
- genMockFromModule(moduleName: string): any,
+ createMockFromModule(moduleName: string): any,
/**
* Mocks a module with an auto-mocked version when it is being required.
*
@@ -845,7 +892,7 @@
* Returns the actual module instead of a mock, bypassing all checks on
* whether the module should receive a mock implementation or not.
*/
- requireActual(moduleName: string): any,
+ requireActual<T>(m: $Flow$ModuleRef<T> | string): T,
/**
* Returns a mock module instead of the actual module, bypassing all checks
* on whether the module should be required normally or not.
@@ -856,14 +903,12 @@
* useful to isolate modules where local state might conflict between tests.
*/
resetModules(): JestObjectType,
-
/**
* Creates a sandbox registry for the modules that are loaded inside the
* callback function. This is useful to isolate specific modules for every
* test so that local module state doesn't conflict between tests.
*/
isolateModules(fn: () => void): JestObjectType,
-
/**
* Exhausts the micro-task queue (usually interfaced in node via
* process.nextTick).
@@ -883,13 +928,6 @@
* or setInterval() and setImmediate()).
*/
advanceTimersByTime(msToRun: number): void,
- /**
- * Executes only the macro task queue (i.e. all tasks queued by setTimeout()
- * or setInterval() and setImmediate()).
- *
- * Renamed to `advanceTimersByTime`.
- */
- runTimersToTime(msToRun: number): void,
/**
* Executes only the macro-tasks that are currently pending (i.e., only the
* tasks that have been queued by setTimeout() or setInterval() up to this
@@ -913,7 +951,7 @@
* (setTimeout, setInterval, clearTimeout, clearInterval, nextTick,
* setImmediate and clearImmediate).
*/
- useFakeTimers(): JestObjectType,
+ useFakeTimers(fakeTimersConfig?: FakeTimersConfig): JestObjectType,
/**
* Instructs Jest to use the real versions of the standard timer functions.
*/
@@ -932,14 +970,13 @@
* Note: The default timeout interval is 5 seconds if this method is not called.
*/
setTimeout(timeout: number): JestObjectType,
+ ...
};
-type JestSpyType = {
- calls: JestCallsType,
-};
+type JestSpyType = { calls: JestCallsType, ... };
type JestDoneFn = {|
- (): void,
+ (error?: Error): void,
fail: (error: Error) => void,
|};
@@ -970,17 +1007,14 @@
* Creates a block that groups together several related tests in one "test suite"
*/
(name: JestTestName, fn: () => void): void,
-
/**
* Only run this describe block
*/
only(name: JestTestName, fn: () => void): void,
-
/**
* Skip running this describe block
*/
skip(name: JestTestName, fn: () => void): void,
-
/**
* each runs this test against array of argument arrays per each run
*
@@ -993,6 +1027,7 @@
fn?: (...args: Array<any>) => ?Promise<mixed>,
timeout?: number
) => void,
+ ...
};
/** An individual test unit */
@@ -1009,7 +1044,6 @@
fn?: (done: JestDoneFn) => ?Promise<mixed>,
timeout?: number
): void,
-
/**
* Only run this test
*
@@ -1029,9 +1063,8 @@
name: JestTestName,
fn?: (...args: Array<any>) => ?Promise<mixed>,
timeout?: number
- ) => void
+ ) => void,
|},
-
/**
* Skip running this test
*
@@ -1039,19 +1072,26 @@
* @param {Function} Test
* @param {number} Timeout for the test, in milliseconds.
*/
- skip(
- name: JestTestName,
- fn?: (done: JestDoneFn) => ?Promise<mixed>,
- timeout?: number
- ): void,
-
+ skip: {|
+ (
+ name: JestTestName,
+ fn?: (done: JestDoneFn) => ?Promise<mixed>,
+ timeout?: number
+ ): void,
+ each(
+ ...table: Array<Array<mixed> | mixed> | [Array<string>, string]
+ ): (
+ name: JestTestName,
+ fn?: (...args: Array<any>) => ?Promise<mixed>,
+ timeout?: number
+ ) => void,
+ |},
/**
* Highlight planned tests in the summary output
*
* @param {String} Name of Test to do
*/
todo(name: string): void,
-
/**
* Run the test concurrently
*
@@ -1064,7 +1104,6 @@
fn?: (done: JestDoneFn) => ?Promise<mixed>,
timeout?: number
): void,
-
/**
* each runs this test against array of argument arrays per each run
*
@@ -1077,6 +1116,7 @@
fn?: (...args: Array<any>) => ?Promise<mixed>,
timeout?: number
) => void,
+ ...
};
declare function fit(
@@ -1096,16 +1136,37 @@
declare var xtest: typeof it;
type JestPrettyFormatColors = {
- 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 },
+ 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,
+ ...
+ },
+ ...
};
-type JestPrettyFormatIndent = string => string;
+type JestPrettyFormatIndent = (string) => string;
type JestPrettyFormatRefs = Array<any>;
-type JestPrettyFormatPrint = any => string;
+type JestPrettyFormatPrint = (any) => string;
type JestPrettyFormatStringOrNull = string | null;
type JestPrettyFormatOptions = {|
@@ -1136,7 +1197,8 @@
opts: JestPrettyFormatOptions,
colors: JestPrettyFormatColors
) => string,
- test: any => boolean,
+ test: (any) => boolean,
+ ...
};
type JestPrettyFormatPlugins = Array<JestPrettyFormatPlugin>;
@@ -1152,27 +1214,29 @@
DomTestingLibraryType &
JestJQueryMatchersType &
JestStyledComponentsMatchersType &
- JestExtendedMatchersType,
-
+ JestExtendedMatchersType &
+ SnapshotDiffType,
/** Add additional Jasmine matchers to Jest's roster */
- extend(matchers: { [name: string]: JestMatcher }): void,
+ extend(matchers: { [name: string]: JestMatcher, ... }): void,
/** Add a module that formats application-specific data structures. */
addSnapshotSerializer(pluginModule: JestPrettyFormatPlugin): void,
assertions(expectedAssertions: number): void,
hasAssertions(): void,
any(value: mixed): JestAsymmetricEqualityType,
anything(): any,
- arrayContaining(value: Array<mixed>): Array<mixed>,
- objectContaining(value: Object): Object,
+ arrayContaining(value: $ReadOnlyArray<mixed>): Array<mixed>,
+ objectContaining(value: { ... }): Object,
/** Matches any received string that contains the exact expected string. */
stringContaining(value: string): string,
stringMatching(value: string | RegExp): string,
not: {
arrayContaining: (value: $ReadOnlyArray<mixed>) => Array<mixed>,
- objectContaining: (value: {}) => Object,
+ objectContaining: (value: { ... }) => Object,
stringContaining: (value: string) => string,
stringMatching: (value: string | RegExp) => string,
+ ...
},
+ ...
};
// TODO handle return type
@@ -1196,7 +1260,8 @@
createSpyObj(
baseName: string,
methodNames: Array<string>
- ): { [methodName: string]: JestSpyType },
+ ): { [methodName: string]: JestSpyType, ... },
objectContaining(value: Object): Object,
stringMatching(value: string): string,
+ ...
};
diff --git a/keyserver/flow-typed/npm/jest_v26.x.x.js b/web/flow-typed/npm/jest_v29.x.x.js
rename from keyserver/flow-typed/npm/jest_v26.x.x.js
rename to web/flow-typed/npm/jest_v29.x.x.js
--- a/keyserver/flow-typed/npm/jest_v26.x.x.js
+++ b/web/flow-typed/npm/jest_v29.x.x.js
@@ -1,7 +1,7 @@
-// flow-typed signature: ec1949e99980c0b12113832818d455c9
-// flow-typed version: 644a595e77/jest_v26.x.x/flow_>=v0.134.x
+// flow-typed signature: f3f75dec8a0c58e78c2a57e2f81e6f7f
+// flow-typed version: 00ecb7849a/jest_v29.x.x/flow_>=v0.201.x
-type JestMockFn<TArguments: $ReadOnlyArray<*>, TReturn> = {
+type JestMockFn<TArguments: $ReadOnlyArray<any>, TReturn> = {
(...args: TArguments): TReturn,
/**
* An object for introspecting mock calls
@@ -13,6 +13,12 @@
* passed during the call.
*/
calls: Array<TArguments>,
+ /**
+ * An array containing the call arguments of the last call that was made
+ * to this mock function. If the function was not called, it will return
+ * undefined.
+ */
+ lastCall: TArguments,
/**
* An array that contains all the object instances that have been
* instantiated from this mock function.
@@ -161,6 +167,32 @@
*/
type JestTestName = string | Function;
+type FakeableAPI =
+ | 'Date'
+ | 'hrtime'
+ | 'nextTick'
+ | 'performance'
+ | 'queueMicrotask'
+ | 'requestAnimationFrame'
+ | 'cancelAnimationFrame'
+ | 'requestIdleCallback'
+ | 'cancelIdleCallback'
+ | 'setImmediate'
+ | 'clearImmediate'
+ | 'setInterval'
+ | 'clearInterval'
+ | 'setTimeout'
+ | 'clearTimeout';
+
+type FakeTimersConfig = {
+ advanceTimers?: boolean | number,
+ doNotFake?: Array<FakeableAPI>,
+ now?: number | Date,
+ timerLimit?: number,
+ legacyFakeTimers?: boolean,
+ ...
+};
+
/**
* Plugin: jest-styled-components
*/
@@ -627,7 +659,7 @@
* Use .toBeInstanceOf(Class) to check that an object is an instance of a
* class.
*/
- toBeInstanceOf(cls: Class<*>): void;
+ toBeInstanceOf(cls: Class<any>): void;
/**
* .toBeNull() is the same as .toBe(null) but the error messages are a bit
* nicer.
@@ -826,7 +858,7 @@
* Returns a new, unused mock function. Optionally takes a mock
* implementation.
*/
- fn<TArguments: $ReadOnlyArray<*>, TReturn>(
+ fn<TArguments: $ReadOnlyArray<any>, TReturn>(
implementation?: (...args: TArguments) => TReturn
): JestMockFn<TArguments, TReturn>,
/**
@@ -896,13 +928,6 @@
* or setInterval() and setImmediate()).
*/
advanceTimersByTime(msToRun: number): void,
- /**
- * Executes only the macro task queue (i.e. all tasks queued by setTimeout()
- * or setInterval() and setImmediate()).
- *
- * Renamed to `advanceTimersByTime`.
- */
- runTimersToTime(msToRun: number): void,
/**
* Executes only the macro-tasks that are currently pending (i.e., only the
* tasks that have been queued by setTimeout() or setInterval() up to this
@@ -926,7 +951,7 @@
* (setTimeout, setInterval, clearTimeout, clearInterval, nextTick,
* setImmediate and clearImmediate).
*/
- useFakeTimers(mode?: 'modern' | 'legacy'): JestObjectType,
+ useFakeTimers(fakeTimersConfig?: FakeTimersConfig): JestObjectType,
/**
* Instructs Jest to use the real versions of the standard timer functions.
*/
@@ -1199,8 +1224,8 @@
hasAssertions(): void,
any(value: mixed): JestAsymmetricEqualityType,
anything(): any,
- arrayContaining(value: Array<mixed>): Array<mixed>,
- objectContaining(value: Object): Object,
+ arrayContaining(value: $ReadOnlyArray<mixed>): Array<mixed>,
+ objectContaining(value: { ... }): Object,
/** Matches any received string that contains the exact expected string. */
stringContaining(value: string): string,
stringMatching(value: string | RegExp): string,
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Dec 3, 10:40 AM (19 h, 53 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2609821
Default Alt Text
D10545.id35245.diff (33 KB)
Attached To
Mode
D10545: [RN72] Update Jest Flow libdefs
Attached
Detach File
Event Timeline
Log In to Comment