Upgrade jest to 23.4.1 (#537)

Flow types regenerated via flow-typed install jest@23.4.1

Test plan: Travis
This commit is contained in:
Dandelion Mané 2018-07-27 12:28:04 -07:00 committed by GitHub
parent aa3382a8b2
commit 797fb6331d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 1855 additions and 437 deletions

View File

@ -1,5 +1,5 @@
// flow-typed signature: 6e1fc0a644aa956f79029fec0709e597 // flow-typed signature: ad251f3a3446f6ab4e6691a94e701cad
// flow-typed version: 07ebad4796/jest_v22.x.x/flow_>=v0.39.x // flow-typed version: caa120caaa/jest_v23.x.x/flow_>=v0.39.x
type JestMockFn<TArguments: $ReadOnlyArray<*>, TReturn> = { type JestMockFn<TArguments: $ReadOnlyArray<*>, TReturn> = {
(...args: TArguments): TReturn, (...args: TArguments): TReturn,
@ -55,18 +55,39 @@ type JestMockFn<TArguments: $ReadOnlyArray<*>, TReturn> = {
mockImplementationOnce( mockImplementationOnce(
fn: (...args: TArguments) => TReturn fn: (...args: TArguments) => TReturn
): JestMockFn<TArguments, TReturn>, ): JestMockFn<TArguments, TReturn>,
/**
* Accepts a string to use in test result output in place of "jest.fn()" to
* indicate which mock function is being referenced.
*/
mockName(name: string): JestMockFn<TArguments, TReturn>,
/** /**
* Just a simple sugar function for returning `this` * Just a simple sugar function for returning `this`
*/ */
mockReturnThis(): void, mockReturnThis(): void,
/** /**
* Deprecated: use jest.fn(() => value) instead * Accepts a value that will be returned whenever the mock function is called.
*/ */
mockReturnValue(value: TReturn): JestMockFn<TArguments, TReturn>, mockReturnValue(value: TReturn): JestMockFn<TArguments, TReturn>,
/** /**
* Sugar for only returning a value once inside your mock * Sugar for only returning a value once inside your mock
*/ */
mockReturnValueOnce(value: TReturn): JestMockFn<TArguments, TReturn> mockReturnValueOnce(value: TReturn): JestMockFn<TArguments, TReturn>,
/**
* Sugar for jest.fn().mockImplementation(() => Promise.resolve(value))
*/
mockResolvedValue(value: TReturn): JestMockFn<TArguments, Promise<TReturn>>,
/**
* Sugar for jest.fn().mockImplementationOnce(() => Promise.resolve(value))
*/
mockResolvedValueOnce(value: TReturn): JestMockFn<TArguments, Promise<TReturn>>,
/**
* Sugar for jest.fn().mockImplementation(() => Promise.reject(value))
*/
mockRejectedValue(value: TReturn): JestMockFn<TArguments, Promise<any>>,
/**
* Sugar for jest.fn().mockImplementationOnce(() => Promise.reject(value))
*/
mockRejectedValueOnce(value: TReturn): JestMockFn<TArguments, Promise<any>>
}; };
type JestAsymmetricEqualityType = { type JestAsymmetricEqualityType = {
@ -113,6 +134,36 @@ type JestPromiseType = {
resolves: JestExpectType resolves: JestExpectType
}; };
/**
* Jest allows functions and classes to be used as test names in test() and
* describe()
*/
type JestTestName = string | Function;
/**
* Plugin: jest-styled-components
*/
type JestStyledComponentsMatcherValue =
| string
| JestAsymmetricEqualityType
| RegExp
| typeof undefined;
type JestStyledComponentsMatcherOptions = {
media?: string;
modifier?: string;
supports?: string;
}
type JestStyledComponentsMatchersType = {
toHaveStyleRule(
property: string,
value: JestStyledComponentsMatcherValue,
options?: JestStyledComponentsMatcherOptions
): void,
};
/** /**
* Plugin: jest-enzyme * Plugin: jest-enzyme
*/ */
@ -120,14 +171,16 @@ type EnzymeMatchersType = {
toBeChecked(): void, toBeChecked(): void,
toBeDisabled(): void, toBeDisabled(): void,
toBeEmpty(): void, toBeEmpty(): void,
toBeEmptyRender(): void,
toBePresent(): void, toBePresent(): void,
toContainReact(element: React$Element<any>): void, toContainReact(element: React$Element<any>): void,
toExist(): void,
toHaveClassName(className: string): void, toHaveClassName(className: string): void,
toHaveHTML(html: string): void, toHaveHTML(html: string): void,
toHaveProp(propKey: string, propValue?: any): void, toHaveProp: ((propKey: string, propValue?: any) => void) & ((props: Object) => void),
toHaveRef(refName: string): void, toHaveRef(refName: string): void,
toHaveState(stateKey: string, stateValue?: any): void, toHaveState: ((stateKey: string, stateValue?: any) => void) & ((state: Object) => void),
toHaveStyle(styleKey: string, styleValue?: any): void, toHaveStyle: ((styleKey: string, styleValue?: any) => void) & ((style: Object) => void),
toHaveTagName(tagName: string): void, toHaveTagName(tagName: string): void,
toHaveText(text: string): void, toHaveText(text: string): void,
toIncludeText(text: string): void, toIncludeText(text: string): void,
@ -136,8 +189,348 @@ type EnzymeMatchersType = {
toMatchSelector(selector: string): void toMatchSelector(selector: string): void
}; };
type JestExpectType = { // DOM testing library extensions https://github.com/kentcdodds/dom-testing-library#custom-jest-matchers
not: JestExpectType & EnzymeMatchersType, type DomTestingLibraryType = {
toBeInTheDOM(): void,
toHaveTextContent(content: string): void,
toHaveAttribute(name: string, expectedValue?: string): void
};
// Jest JQuery Matchers: https://github.com/unindented/custom-jquery-matchers
type JestJQueryMatchersType = {
toExist(): void,
toHaveLength(len: number): void,
toHaveId(id: string): void,
toHaveClass(className: string): void,
toHaveTag(tag: string): void,
toHaveAttr(key: string, val?: any): void,
toHaveProp(key: string, val?: any): void,
toHaveText(text: string | RegExp): void,
toHaveData(key: string, val?: any): void,
toHaveValue(val: any): void,
toHaveCss(css: {[key: string]: any}): void,
toBeChecked(): void,
toBeDisabled(): void,
toBeEmpty(): void,
toBeHidden(): void,
toBeSelected(): void,
toBeVisible(): void,
toBeFocused(): void,
toBeInDom(): void,
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
type JestExtendedMatchersType = {
/**
* Note: Currently unimplemented
* Passing assertion
*
* @param {String} message
*/
// pass(message: string): void;
/**
* Note: Currently unimplemented
* Failing assertion
*
* @param {String} message
*/
// fail(message: string): void;
/**
* 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`.
*
* Note: Required Jest version >22
* Note: Your mock functions will have to be asynchronous to cause the timestamps inside of Jest to occur in a differentJS event loop, otherwise the mock timestamps will all be the same
*
* @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).
*
* @param {Number} start
* @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.
*
* @param {String} substring
* @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;
};
interface JestExpectType {
not:
& JestExpectType
& EnzymeMatchersType
& DomTestingLibraryType
& JestJQueryMatchersType
& JestStyledComponentsMatchersType
& JestExtendedMatchersType,
/** /**
* If you have a mock function, you can use .lastCalledWith to test what * If you have a mock function, you can use .lastCalledWith to test what
* arguments it was last called with. * arguments it was last called with.
@ -148,10 +541,6 @@ type JestExpectType = {
* strict equality. * strict equality.
*/ */
toBe(value: any): void, toBe(value: any): void,
/**
* Use .toHaveBeenCalled to ensure that a mock function got called.
*/
toBeCalled(): void,
/** /**
* Use .toBeCalledWith to ensure that a mock function was called with * Use .toBeCalledWith to ensure that a mock function was called with
* specific arguments. * specific arguments.
@ -227,21 +616,55 @@ type JestExpectType = {
* Use .toHaveBeenCalled to ensure that a mock function got called. * Use .toHaveBeenCalled to ensure that a mock function got called.
*/ */
toHaveBeenCalled(): void, toHaveBeenCalled(): void,
toBeCalled(): void;
/** /**
* Use .toHaveBeenCalledTimes to ensure that a mock function got called exact * Use .toHaveBeenCalledTimes to ensure that a mock function got called exact
* number of times. * number of times.
*/ */
toHaveBeenCalledTimes(number: number): void, toHaveBeenCalledTimes(number: number): void,
toBeCalledTimes(number: number): void;
/**
*
*/
toHaveBeenNthCalledWith(nthCall: number, ...args: Array<any>): void;
nthCalledWith(nthCall: number, ...args: Array<any>): void;
/**
*
*/
toHaveReturned(): void;
toReturn(): void;
/**
*
*/
toHaveReturnedTimes(number: number): void;
toReturnTimes(number: number): void;
/**
*
*/
toHaveReturnedWith(value: any): void;
toReturnWith(value: any): void;
/**
*
*/
toHaveLastReturnedWith(value: any): void;
lastReturnedWith(value: any): void;
/**
*
*/
toHaveNthReturnedWith(nthCall: number, value: any): void;
nthReturnedWith(nthCall: number, value: any): void;
/** /**
* Use .toHaveBeenCalledWith to ensure that a mock function was called with * Use .toHaveBeenCalledWith to ensure that a mock function was called with
* specific arguments. * specific arguments.
*/ */
toHaveBeenCalledWith(...args: Array<any>): void, toHaveBeenCalledWith(...args: Array<any>): void,
toBeCalledWith(...args: Array<any>): void,
/** /**
* Use .toHaveBeenLastCalledWith to ensure that a mock function was last called * Use .toHaveBeenLastCalledWith to ensure that a mock function was last called
* with specific arguments. * with specific arguments.
*/ */
toHaveBeenLastCalledWith(...args: Array<any>): void, toHaveBeenLastCalledWith(...args: Array<any>): void,
lastCalledWith(...args: Array<any>): void,
/** /**
* Check that an object has a .length property and it is set to a certain * Check that an object has a .length property and it is set to a certain
* numeric value. * numeric value.
@ -260,9 +683,17 @@ type JestExpectType = {
*/ */
toMatchObject(object: Object | Array<Object>): void, toMatchObject(object: Object | Array<Object>): void,
/** /**
* This ensures that a React component matches the most recent snapshot. * Use .toStrictEqual to check that a javascript object matches a subset of the properties of an object.
*/ */
toMatchSnapshot(name?: string): void, toStrictEqual(value: any): void,
/**
* This ensures that an Object matches the most recent snapshot.
*/
toMatchSnapshot(propertyMatchers?: {[key: string]: JestAsymmetricEqualityType}, name?: string): void,
/**
* This ensures that an Object matches the most recent snapshot.
*/
toMatchSnapshot(name: string): void,
/** /**
* Use .toThrow to test that a function throws when it is called. * 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 * If you want to test that a specific error gets thrown, you can provide an
@ -278,7 +709,7 @@ type JestExpectType = {
* matching the most recent snapshot when it is called. * matching the most recent snapshot when it is called.
*/ */
toThrowErrorMatchingSnapshot(): void toThrowErrorMatchingSnapshot(): void
}; }
type JestObjectType = { type JestObjectType = {
/** /**
@ -391,6 +822,13 @@ type JestObjectType = {
* Executes only the macro task queue (i.e. all tasks queued by setTimeout() * Executes only the macro task queue (i.e. all tasks queued by setTimeout()
* or setInterval() and setImmediate()). * 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, runTimersToTime(msToRun: number): void,
/** /**
* Executes only the macro-tasks that are currently pending (i.e., only the * Executes only the macro-tasks that are currently pending (i.e., only the
@ -424,7 +862,7 @@ type JestObjectType = {
* Creates a mock function similar to jest.fn but also tracks calls to * Creates a mock function similar to jest.fn but also tracks calls to
* object[methodName]. * object[methodName].
*/ */
spyOn(object: Object, methodName: string): JestMockFn<any, any>, spyOn(object: Object, methodName: string, accessType?: "get" | "set"): JestMockFn<any, any>,
/** /**
* Set the default timeout interval for tests and before/after hooks in milliseconds. * Set the default timeout interval for tests and before/after hooks in milliseconds.
* Note: The default timeout interval is 5 seconds if this method is not called. * Note: The default timeout interval is 5 seconds if this method is not called.
@ -462,17 +900,17 @@ declare var describe: {
/** /**
* Creates a block that groups together several related tests in one "test suite" * Creates a block that groups together several related tests in one "test suite"
*/ */
(name: string, fn: () => void): void, (name: JestTestName, fn: () => void): void,
/** /**
* Only run this describe block * Only run this describe block
*/ */
only(name: string, fn: () => void): void, only(name: JestTestName, fn: () => void): void,
/** /**
* Skip running this describe block * Skip running this describe block
*/ */
skip(name: string, fn: () => void): void skip(name: JestTestName, fn: () => void): void
}; };
/** An individual test unit */ /** An individual test unit */
@ -480,54 +918,72 @@ declare var it: {
/** /**
* An individual test unit * An individual test unit
* *
* @param {string} Name of Test * @param {JestTestName} Name of Test
* @param {Function} Test * @param {Function} Test
* @param {number} Timeout for the test, in milliseconds. * @param {number} Timeout for the test, in milliseconds.
*/ */
( (
name: string, name: JestTestName,
fn?: (done: () => void) => ?Promise<mixed>, fn?: (done: () => void) => ?Promise<mixed>,
timeout?: number timeout?: number
): void, ): void,
/**
* each runs this test against array of argument arrays per each run
*
* @param {table} table of Test
*/
each(
table: Array<Array<mixed>>
): (
name: JestTestName,
fn?: (...args: Array<any>) => ?Promise<mixed>
) => void,
/** /**
* Only run this test * Only run this test
* *
* @param {string} Name of Test * @param {JestTestName} Name of Test
* @param {Function} Test * @param {Function} Test
* @param {number} Timeout for the test, in milliseconds. * @param {number} Timeout for the test, in milliseconds.
*/ */
only( only(
name: string, name: JestTestName,
fn?: (done: () => void) => ?Promise<mixed>, fn?: (done: () => void) => ?Promise<mixed>,
timeout?: number timeout?: number
): void, ): {
each(
table: Array<Array<mixed>>
): (
name: JestTestName,
fn?: (...args: Array<any>) => ?Promise<mixed>
) => void,
},
/** /**
* Skip running this test * Skip running this test
* *
* @param {string} Name of Test * @param {JestTestName} Name of Test
* @param {Function} Test * @param {Function} Test
* @param {number} Timeout for the test, in milliseconds. * @param {number} Timeout for the test, in milliseconds.
*/ */
skip( skip(
name: string, name: JestTestName,
fn?: (done: () => void) => ?Promise<mixed>, fn?: (done: () => void) => ?Promise<mixed>,
timeout?: number timeout?: number
): void, ): void,
/** /**
* Run the test concurrently * Run the test concurrently
* *
* @param {string} Name of Test * @param {JestTestName} Name of Test
* @param {Function} Test * @param {Function} Test
* @param {number} Timeout for the test, in milliseconds. * @param {number} Timeout for the test, in milliseconds.
*/ */
concurrent( concurrent(
name: string, name: JestTestName,
fn?: (done: () => void) => ?Promise<mixed>, fn?: (done: () => void) => ?Promise<mixed>,
timeout?: number timeout?: number
): void ): void
}; };
declare function fit( declare function fit(
name: string, name: JestTestName,
fn: (done: () => void) => ?Promise<mixed>, fn: (done: () => void) => ?Promise<mixed>,
timeout?: number timeout?: number
): void; ): void;
@ -542,23 +998,83 @@ declare var xit: typeof it;
/** A disabled individual test */ /** A disabled individual test */
declare var xtest: 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 },
};
type JestPrettyFormatIndent = string => string;
type JestPrettyFormatRefs = Array<any>;
type JestPrettyFormatPrint = any => string;
type JestPrettyFormatStringOrNull = string | null;
type JestPrettyFormatOptions = {|
callToJSON: boolean,
edgeSpacing: string,
escapeRegex: boolean,
highlight: boolean,
indent: number,
maxDepth: number,
min: boolean,
plugins: JestPrettyFormatPlugins,
printFunctionName: boolean,
spacing: string,
theme: {|
comment: string,
content: string,
prop: string,
tag: string,
value: string,
|},
|};
type JestPrettyFormatPlugin = {
print: (
val: any,
serialize: JestPrettyFormatPrint,
indent: JestPrettyFormatIndent,
opts: JestPrettyFormatOptions,
colors: JestPrettyFormatColors,
) => string,
test: any => boolean,
};
type JestPrettyFormatPlugins = Array<JestPrettyFormatPlugin>;
/** The expect function is used every time you want to test a value */ /** The expect function is used every time you want to test a value */
declare var expect: { declare var expect: {
/** The object that you want to make assertions against */ /** The object that you want to make assertions against */
(value: any): JestExpectType & JestPromiseType & EnzymeMatchersType, (value: any):
& JestExpectType
& JestPromiseType
& EnzymeMatchersType
& DomTestingLibraryType
& JestJQueryMatchersType
& JestStyledComponentsMatchersType
& JestExtendedMatchersType,
/** Add additional Jasmine matchers to Jest's roster */ /** 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. */ /** Add a module that formats application-specific data structures. */
addSnapshotSerializer(serializer: (input: Object) => string): void, addSnapshotSerializer(pluginModule: JestPrettyFormatPlugin): void,
assertions(expectedAssertions: number): void, assertions(expectedAssertions: number): void,
hasAssertions(): void, hasAssertions(): void,
any(value: mixed): JestAsymmetricEqualityType, any(value: mixed): JestAsymmetricEqualityType,
anything(): void, anything(): any,
arrayContaining(value: Array<mixed>): void, arrayContaining(value: Array<mixed>): Array<mixed>,
objectContaining(value: Object): void, objectContaining(value: Object): Object,
/** Matches any received string that contains the exact expected string. */ /** Matches any received string that contains the exact expected string. */
stringContaining(value: string): void, stringContaining(value: string): string,
stringMatching(value: string | RegExp): void stringMatching(value: string | RegExp): string,
not: {
arrayContaining: (value: $ReadOnlyArray<mixed>) => Array<mixed>,
objectContaining: (value: {}) => Object,
stringContaining: (value: string) => string,
stringMatching: (value: string | RegExp) => string,
},
}; };
// TODO handle return type // TODO handle return type
@ -575,14 +1091,14 @@ declare var jest: JestObjectType;
declare var jasmine: { declare var jasmine: {
DEFAULT_TIMEOUT_INTERVAL: number, DEFAULT_TIMEOUT_INTERVAL: number,
any(value: mixed): JestAsymmetricEqualityType, any(value: mixed): JestAsymmetricEqualityType,
anything(): void, anything(): any,
arrayContaining(value: Array<mixed>): void, arrayContaining(value: Array<mixed>): Array<mixed>,
clock(): JestClockType, clock(): JestClockType,
createSpy(name: string): JestSpyType, createSpy(name: string): JestSpyType,
createSpyObj( createSpyObj(
baseName: string, baseName: string,
methodNames: Array<string> methodNames: Array<string>
): { [methodName: string]: JestSpyType }, ): { [methodName: string]: JestSpyType },
objectContaining(value: Object): void, objectContaining(value: Object): Object,
stringMatching(value: string): void stringMatching(value: string): string
}; };

View File

@ -36,7 +36,7 @@
"fs-extra": "3.0.1", "fs-extra": "3.0.1",
"html-webpack-plugin": "2.29.0", "html-webpack-plugin": "2.29.0",
"isomorphic-fetch": "^2.2.1", "isomorphic-fetch": "^2.2.1",
"jest": "20.0.4", "jest": "23.4.1",
"json-stable-stringify": "^1.0.1", "json-stable-stringify": "^1.0.1",
"lodash.clonedeep": "^4.5.0", "lodash.clonedeep": "^4.5.0",
"lodash.isequal": "^4.5.0", "lodash.isequal": "^4.5.0",

1692
yarn.lock

File diff suppressed because it is too large Load Diff