From 05ff52b656039db81163de006ea6c93ec820dfae Mon Sep 17 00:00:00 2001 From: Moti Zilberman Date: Wed, 18 Jan 2023 10:52:29 -0800 Subject: [PATCH] Update Jest type definitions to v29 Summary: @public Changelog: [Internal] TSIA Reviewed By: jacdebug Differential Revision: D42570767 fbshipit-source-id: 26deffc1a749ed9403a71dcef64db02d0bf652e8 --- .../__tests__/InteractionManager-test.js | 2 +- flow/jest.js | 422 +++++++++++------- 2 files changed, 259 insertions(+), 165 deletions(-) diff --git a/Libraries/Interaction/__tests__/InteractionManager-test.js b/Libraries/Interaction/__tests__/InteractionManager-test.js index b0757356d8c..a1a41250e5d 100644 --- a/Libraries/Interaction/__tests__/InteractionManager-test.js +++ b/Libraries/Interaction/__tests__/InteractionManager-test.js @@ -168,7 +168,7 @@ describe('promise tasks', () => { } beforeEach(() => { jest.resetModules(); - jest.useFakeTimers('legacy'); + jest.useFakeTimers({legacyFakeTimers: true}); InteractionManager = require('../InteractionManager'); BatchedBridge = require('../../BatchedBridge/BatchedBridge'); sequenceId = 0; diff --git a/flow/jest.js b/flow/jest.js index 5dd8790ce2b..d03dff099f9 100644 --- a/flow/jest.js +++ b/flow/jest.js @@ -4,18 +4,18 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * + * @flow * @format + * @oncall react_native */ -// Modified from https://raw.githubusercontent.com/flow-typed/flow-typed/master/definitions/npm/jest_v23.x.x/flow_v0.39.x-v0.103.x/jest_v23.x.x.js -// List of modifications: -// - fix some [] -> Array lint warnings -// - make it.each/describe.each take $ReadOnlyArray instead of Array -// - added definition for `isolateModules` -// -// TODO(T35016336) remove the .each modifications if flow-typed adopts them +// Modified from https://raw.githubusercontent.com/flow-typed/flow-typed/master/definitions/npm/jest_v29.x.x/flow_v0.134.x-/jest_v29.x.x.js +// Modifications are explained inline by comments beginning with `// MODIFIED`. -type JestMockFn, TReturn> = {| +// MODIFIED: Added ESLint suppression comment - no-unused-vars doesn't understand declaration files +/* eslint-disable no-unused-vars */ + +type JestMockFn, TReturn> = { (...args: TArguments): TReturn, /** * An object for introspecting mock calls @@ -27,6 +27,12 @@ type JestMockFn, TReturn> = {| * passed during the call. */ calls: Array, + /** + * 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. @@ -36,7 +42,11 @@ type JestMockFn, TReturn> = {| * 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, + ... + }>, ... }, /** @@ -110,7 +120,8 @@ type JestMockFn, TReturn> = {| * Sugar for jest.fn().mockImplementationOnce(() => Promise.reject(value)) */ mockRejectedValueOnce(value: TReturn): JestMockFn>, -|}; + ... +}; type JestAsymmetricEqualityType = { /** @@ -146,8 +157,8 @@ type JestMatcherResult = { }; type JestMatcher = ( - actual: any, - expected: any, + received: any, + ...actual: Array ) => JestMatcherResult | Promise; type JestPromiseType = { @@ -170,6 +181,32 @@ type JestPromiseType = { */ 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, + now?: number | Date, + timerLimit?: number, + legacyFakeTimers?: boolean, + ... +}; + /** * Plugin: jest-styled-components */ @@ -200,36 +237,77 @@ type JestStyledComponentsMatchersType = { * Plugin: jest-enzyme */ type EnzymeMatchersType = { + // 5.x + toBeEmpty(): void, + toBePresent(): void, + // 6.x toBeChecked(): void, toBeDisabled(): void, - toBeEmpty(): void, toBeEmptyRender(): void, - toBePresent(): void, + toContainMatchingElement(selector: string): void, + toContainMatchingElements(n: number, selector: string): void, + toContainExactlyOneMatchingElement(selector: string): void, toContainReact(element: React$Element): void, toExist(): void, toHaveClassName(className: string): void, toHaveHTML(html: string): void, toHaveProp: ((propKey: string, propValue?: any) => void) & - ((props: Object) => void), + ((props: {...}) => void), toHaveRef(refName: string): void, toHaveState: ((stateKey: string, stateValue?: any) => void) & - ((state: Object) => void), + ((state: {...}) => void), toHaveStyle: ((styleKey: string, styleValue?: any) => void) & - ((style: Object) => void), + ((style: {...}) => void), toHaveTagName(tagName: string): void, toHaveText(text: string): void, - toIncludeText(text: string): void, toHaveValue(value: any): void, - toMatchElement(element: React$Element): void, + toIncludeText(text: string): void, + toMatchElement( + element: React$Element, + options?: {|ignoreProps?: boolean, verbose?: boolean|}, + ): void, toMatchSelector(selector: string): void, + // 7.x + toHaveDisplayName(name: string): void, ... }; -// DOM testing library extensions https://github.com/kentcdodds/dom-testing-library#custom-jest-matchers +// DOM testing library extensions (jest-dom) +// https://github.com/testing-library/jest-dom type DomTestingLibraryType = { - toBeInTheDOM(): void, - toHaveTextContent(content: string): void, - toHaveAttribute(name: string, expectedValue?: string): void, + /** + * @deprecated + */ + toBeInTheDOM(container?: HTMLElement): void, + + // 4.x + toBeInTheDocument(): void, + toBeVisible(): void, + toBeEmpty(): void, + toBeDisabled(): void, + toBeEnabled(): void, + toBeInvalid(): void, + toBeRequired(): void, + toBeValid(): void, + toContainElement(element: HTMLElement | null): void, + toContainHTML(htmlText: string): void, + toHaveAttribute(attr: string, value?: any): void, + toHaveClass(...classNames: string[]): void, + toHaveFocus(): void, + toHaveFormValues(expectedValues: {[name: string]: any, ...}): void, + toHaveStyle(css: string | {[name: string]: any, ...}): void, + toHaveTextContent( + text: string | RegExp, + 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, ... }; @@ -282,78 +360,64 @@ type JestExtendedMatchersType = { * 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: Array): void, - + 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: Array): void, - + 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: Array): void, - + 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`. * @@ -363,42 +427,34 @@ type JestExtendedMatchersType = { * @param {Mock} mock */ toHaveBeenCalledBefore(mock: JestMockFn): 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). * @@ -406,144 +462,122 @@ type JestExtendedMatchersType = { * @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.} keys */ - toContainKeys(keys: Array): void, - + toContainKeys(keys: string[]): void, /** * Use `.toContainAllKeys` when checking if an object only contains all of the provided keys. * * @param {Array.} keys */ - toContainAllKeys(keys: Array): void, - + toContainAllKeys(keys: string[]): void, /** * Use `.toContainAnyKeys` when checking if an object contains at least one of the provided keys. * * @param {Array.} keys */ - toContainAnyKeys(keys: Array): void, - + 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: Array): void, - + toContainValues(values: any[]): void, /** * Use `.toContainAllValues` when checking if an object only contains all of the provided values. * * @param {Array.<*>} values */ - toContainAllValues(values: Array): void, - + toContainAllValues(values: any[]): void, /** * Use `.toContainAnyValues` when checking if an object contains at least one of the provided values. * * @param {Array.<*>} values */ - toContainAnyValues(values: Array): void, - + toContainAnyValues(values: any[]): void, /** * Use `.toContainEntry` when checking if an object contains the provided entry. * * @param {Array.} entry */ toContainEntry(entry: [string, string]): void, - /** * Use `.toContainEntries` when checking if an object contains all of the provided entries. * * @param {Array.>} entries */ - toContainEntries(entries: Array<[string, string]>): void, - + toContainEntries(entries: [string, string][]): void, /** * Use `.toContainAllEntries` when checking if an object only contains all of the provided entries. * * @param {Array.>} entries */ - toContainAllEntries(entries: Array<[string, string]>): void, - + toContainAllEntries(entries: [string, string][]): void, /** * Use `.toContainAnyEntries` when checking if an object contains at least one of the provided entries. * * @param {Array.>} entries */ - toContainAnyEntries(entries: Array<[string, string]>): void, - + 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. * @@ -551,13 +585,34 @@ type JestExtendedMatchersType = { * @param {Number} times */ toIncludeRepeated(substring: string, times: number): void, - /** * Use `.toIncludeMultiple` when checking if a `String` includes all of the given substrings. * * @param {Array.} substring */ - toIncludeMultiple(substring: Array): void, + 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, ... }; @@ -567,7 +622,8 @@ interface JestExpectType { 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. @@ -710,7 +766,7 @@ interface JestExpectType { /** * */ - toHaveProperty(propPath: string, value?: any): void; + toHaveProperty(propPath: string | $ReadOnlyArray, value?: any): void; /** * Use .toMatch to check that a string matches a regular expression or string. */ @@ -726,20 +782,14 @@ interface JestExpectType { /** * This ensures that an Object matches the most recent snapshot. */ - toMatchSnapshot( - propertyMatchers?: {[key: string]: JestAsymmetricEqualityType, ...}, - name?: string, - ): void; + toMatchSnapshot(propertyMatchers?: any, name?: string): void; /** * This ensures that an Object matches the most recent snapshot. */ toMatchSnapshot(name: string): void; toMatchInlineSnapshot(snapshot?: string): void; - toMatchInlineSnapshot( - propertyMatchers?: {[key: string]: JestAsymmetricEqualityType, ...}, - snapshot?: string, - ): void; + toMatchInlineSnapshot(propertyMatchers?: any, snapshot?: string): void; /** * Use .toThrow to test that a function throws when it is called. * If you want to test that a specific error gets thrown, you can provide an @@ -796,6 +846,18 @@ type JestObjectType = { * Removes any pending timers from the timer system. */ clearAllTimers(): void, + /** + * 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. @@ -810,6 +872,7 @@ type JestObjectType = { * Returns a new, unused mock function. Optionally takes a mock * implementation. */ + // MODIFIED: Added defaults to type arguments. fn = $ReadOnlyArray, TReturn = any>( implementation?: (...args: TArguments) => TReturn, ): JestMockFn, @@ -817,11 +880,15 @@ type JestObjectType = { * 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. * @@ -851,6 +918,12 @@ type JestObjectType = { * 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). @@ -870,13 +943,6 @@ type JestObjectType = { * 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 @@ -900,7 +966,7 @@ type JestObjectType = { * (setTimeout, setInterval, clearTimeout, clearInterval, nextTick, * setImmediate and clearImmediate). */ - useFakeTimers(type?: 'legacy' | 'modern'): JestObjectType, + useFakeTimers(fakeTimersConfig?: FakeTimersConfig): JestObjectType, /** * Instructs Jest to use the real versions of the standard timer functions. */ @@ -922,29 +988,31 @@ type JestObjectType = { ... }; -type JestSpyType = { - calls: JestCallsType, - ... -}; +type JestSpyType = {calls: JestCallsType, ...}; + +type JestDoneFn = {| + (error?: Error): void, + fail: (error: Error) => void, +|}; /** Runs this function after every test inside this context */ declare function afterEach( - fn: (done: () => void) => ?Promise, + fn: (done: JestDoneFn) => ?Promise, timeout?: number, ): void; /** Runs this function before every test inside this context */ declare function beforeEach( - fn: (done: () => void) => ?Promise, + fn: (done: JestDoneFn) => ?Promise, timeout?: number, ): void; /** Runs this function after all tests have finished inside this context */ declare function afterAll( - fn: (done: () => void) => ?Promise, + fn: (done: JestDoneFn) => ?Promise, timeout?: number, ): void; /** Runs this function before any tests have started inside this context */ declare function beforeAll( - fn: (done: () => void) => ?Promise, + fn: (done: JestDoneFn) => ?Promise, timeout?: number, ): void; @@ -954,27 +1022,25 @@ declare var describe: { * 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 * * @param {table} table of Test */ - each | mixed>( - table: $ReadOnlyArray, + each( + ...table: Array | mixed> | [Array, string] ): ( name: JestTestName, - fn?: (...args: TArguments) => ?Promise, + fn?: (...args: Array) => ?Promise, + timeout?: number, ) => void, ... }; @@ -990,20 +1056,9 @@ declare var it: { */ ( name: JestTestName, - fn?: (done: () => void) => ?Promise, + fn?: (done: JestDoneFn) => ?Promise, timeout?: number, ): void, - /** - * each runs this test against array of argument arrays per each run - * - * @param {table} table of Test - */ - each | mixed>( - table: $ReadOnlyArray, - ): ( - name: JestTestName, - fn?: (...args: TArguments) => ?Promise, - ) => void, /** * Only run this test * @@ -1011,19 +1066,20 @@ declare var it: { * @param {Function} Test * @param {number} Timeout for the test, in milliseconds. */ - only( - name: JestTestName, - fn?: (done: () => void) => ?Promise, - timeout?: number, - ): { - each | mixed>( - table: $ReadOnlyArray, + only: {| + ( + name: JestTestName, + fn?: (done: JestDoneFn) => ?Promise, + timeout?: number, + ): void, + each( + ...table: Array | mixed> | [Array, string] ): ( name: JestTestName, - fn?: (...args: TArguments) => ?Promise, + fn?: (...args: Array) => ?Promise, + timeout?: number, ) => void, - ... - }, + |}, /** * Skip running this test * @@ -1031,11 +1087,26 @@ declare var it: { * @param {Function} Test * @param {number} Timeout for the test, in milliseconds. */ - skip( - name: JestTestName, - fn?: (done: () => void) => ?Promise, - timeout?: number, - ): void, + skip: {| + ( + name: JestTestName, + fn?: (done: JestDoneFn) => ?Promise, + timeout?: number, + ): void, + each( + ...table: Array | mixed> | [Array, string] + ): ( + name: JestTestName, + fn?: (...args: Array) => ?Promise, + 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 * @@ -1045,14 +1116,27 @@ declare var it: { */ concurrent( name: JestTestName, - fn?: (done: () => void) => ?Promise, + fn?: (done: JestDoneFn) => ?Promise, timeout?: number, ): void, + /** + * each runs this test against array of argument arrays per each run + * + * @param {table} table of Test + */ + each( + ...table: Array | mixed> | [Array, string] + ): ( + name: JestTestName, + fn?: (...args: Array) => ?Promise, + timeout?: number, + ) => void, ... }; + declare function fit( name: JestTestName, - fn: (done: () => void) => ?Promise, + fn: (done: JestDoneFn) => ?Promise, timeout?: number, ): void; /** An individual test unit */ @@ -1067,16 +1151,38 @@ declare var xit: typeof it; 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 JestPrettyFormatRefs = Array; type JestPrettyFormatPrint = any => string; +type JestPrettyFormatStringOrNull = string | null; type JestPrettyFormatOptions = {| callToJSON: boolean, @@ -1123,8 +1229,8 @@ declare var expect: { DomTestingLibraryType & JestJQueryMatchersType & JestStyledComponentsMatchersType & - JestExtendedMatchersType, - + JestExtendedMatchersType & + SnapshotDiffType, /** Add additional Jasmine matchers to Jest's roster */ extend(matchers: {[name: string]: JestMatcher, ...}): void, /** Add a module that formats application-specific data structures. */ @@ -1133,6 +1239,7 @@ declare var expect: { hasAssertions(): void, any(value: mixed): JestAsymmetricEqualityType, anything(): any, + // MODIFIED: Array -> $ReadOnlyArray arrayContaining(value: $ReadOnlyArray): Array, objectContaining(value: Object): Object, /** Matches any received string that contains the exact expected string. */ @@ -1155,18 +1262,6 @@ declare function spyOn(value: mixed, method: string): Object; /** Holds all functions related to manipulating test runner */ declare var jest: JestObjectType; -/** - * https://jasmine.github.io/2.4/custom_reporter.html - */ -type JasmineReporter = { - jasmineStarted?: (suiteInfo: mixed) => void, - suiteStarted?: (result: mixed) => void, - specStarted?: (result: mixed) => void, - specDone?: (result: mixed) => void, - suiteDone?: (result: mixed) => void, - ... -}; - /** * The global Jasmine object, this is generally not exposed as the public API, * using features inside here could break in later versions of Jest. @@ -1175,14 +1270,13 @@ declare var jasmine: { DEFAULT_TIMEOUT_INTERVAL: number, any(value: mixed): JestAsymmetricEqualityType, anything(): any, - arrayContaining(value: $ReadOnlyArray): Array, + arrayContaining(value: Array): Array, clock(): JestClockType, createSpy(name: string): JestSpyType, createSpyObj( baseName: string, methodNames: Array, ): {[methodName: string]: JestSpyType, ...}, - getEnv(): {addReporter: (jasmineReporter: JasmineReporter) => void, ...}, objectContaining(value: Object): Object, stringMatching(value: string): string, ...