flow: add libdefs that have clean updates (#1311)
Summary: Generated by running `flow-typed install --skip --overwrite` and reverting a minimal set of libdefs such that the change does not introduce any Flow errors (except Prettier, which is covered by #1307). Addresses parts of #1308. Changes: - `chalk`: upgraded v1.x.x to v2.x.x - `flow-bin`: no-op; explicit Flow window widening - `isomorphic-fetch`: no-op; formatting change - `jest`: updates for Flow v0.104.x (explicit inexact objects), and also some functional additions - `object-assign`: no-op; explicit Flow window widening - `rimraf`: added new at v2.x.x Test Plan: Flow passes, by construction. wchargin-branch: libdefs-clean
This commit is contained in:
parent
158dc0b831
commit
ecd15ed3c4
|
@ -1,114 +0,0 @@
|
|||
// flow-typed signature: f965116cdb881170be8c42b10554e195
|
||||
// flow-typed version: da30fe6876/chalk_v1.x.x/flow_>=v0.25.x
|
||||
|
||||
type $npm$chalk$StyleElement = {
|
||||
open: string,
|
||||
close: string
|
||||
};
|
||||
|
||||
type $npm$chalk$Chain = $npm$chalk$Style & ((...text: any[]) => string);
|
||||
|
||||
type $npm$chalk$Style = {
|
||||
// General
|
||||
reset: $npm$chalk$Chain,
|
||||
bold: $npm$chalk$Chain,
|
||||
dim: $npm$chalk$Chain,
|
||||
italic: $npm$chalk$Chain,
|
||||
underline: $npm$chalk$Chain,
|
||||
inverse: $npm$chalk$Chain,
|
||||
strikethrough: $npm$chalk$Chain,
|
||||
|
||||
// Text colors
|
||||
black: $npm$chalk$Chain,
|
||||
red: $npm$chalk$Chain,
|
||||
green: $npm$chalk$Chain,
|
||||
yellow: $npm$chalk$Chain,
|
||||
blue: $npm$chalk$Chain,
|
||||
magenta: $npm$chalk$Chain,
|
||||
cyan: $npm$chalk$Chain,
|
||||
white: $npm$chalk$Chain,
|
||||
gray: $npm$chalk$Chain,
|
||||
grey: $npm$chalk$Chain,
|
||||
|
||||
// Background colors
|
||||
bgBlack: $npm$chalk$Chain,
|
||||
bgRed: $npm$chalk$Chain,
|
||||
bgGreen: $npm$chalk$Chain,
|
||||
bgYellow: $npm$chalk$Chain,
|
||||
bgBlue: $npm$chalk$Chain,
|
||||
bgMagenta: $npm$chalk$Chain,
|
||||
bgCyan: $npm$chalk$Chain,
|
||||
bgWhite: $npm$chalk$Chain
|
||||
};
|
||||
|
||||
type $npm$chalk$StyleMap = {
|
||||
// General
|
||||
reset: $npm$chalk$StyleElement,
|
||||
bold: $npm$chalk$StyleElement,
|
||||
dim: $npm$chalk$StyleElement,
|
||||
italic: $npm$chalk$StyleElement,
|
||||
underline: $npm$chalk$StyleElement,
|
||||
inverse: $npm$chalk$StyleElement,
|
||||
strikethrough: $npm$chalk$StyleElement,
|
||||
|
||||
// Text colors
|
||||
black: $npm$chalk$StyleElement,
|
||||
red: $npm$chalk$StyleElement,
|
||||
green: $npm$chalk$StyleElement,
|
||||
yellow: $npm$chalk$StyleElement,
|
||||
blue: $npm$chalk$StyleElement,
|
||||
magenta: $npm$chalk$StyleElement,
|
||||
cyan: $npm$chalk$StyleElement,
|
||||
white: $npm$chalk$StyleElement,
|
||||
gray: $npm$chalk$StyleElement,
|
||||
|
||||
// Background colors
|
||||
bgBlack: $npm$chalk$StyleElement,
|
||||
bgRed: $npm$chalk$StyleElement,
|
||||
bgGreen: $npm$chalk$StyleElement,
|
||||
bgYellow: $npm$chalk$StyleElement,
|
||||
bgBlue: $npm$chalk$StyleElement,
|
||||
bgMagenta: $npm$chalk$StyleElement,
|
||||
bgCyan: $npm$chalk$StyleElement,
|
||||
bgWhite: $npm$chalk$StyleElement
|
||||
};
|
||||
|
||||
declare module "chalk" {
|
||||
declare var enabled: boolean;
|
||||
declare var supportsColor: boolean;
|
||||
declare var styles: $npm$chalk$StyleMap;
|
||||
|
||||
declare function stripColor(value: string): any;
|
||||
declare function hasColor(str: string): boolean;
|
||||
|
||||
// General
|
||||
declare var reset: $npm$chalk$Chain;
|
||||
declare var bold: $npm$chalk$Chain;
|
||||
declare var dim: $npm$chalk$Chain;
|
||||
declare var italic: $npm$chalk$Chain;
|
||||
declare var underline: $npm$chalk$Chain;
|
||||
declare var inverse: $npm$chalk$Chain;
|
||||
declare var strikethrough: $npm$chalk$Chain;
|
||||
|
||||
// Text colors
|
||||
declare var black: $npm$chalk$Chain;
|
||||
declare var red: $npm$chalk$Chain;
|
||||
declare var green: $npm$chalk$Chain;
|
||||
declare var yellow: $npm$chalk$Chain;
|
||||
declare var blue: $npm$chalk$Chain;
|
||||
declare var magenta: $npm$chalk$Chain;
|
||||
declare var cyan: $npm$chalk$Chain;
|
||||
declare var white: $npm$chalk$Chain;
|
||||
declare var gray: $npm$chalk$Chain;
|
||||
declare var grey: $npm$chalk$Chain;
|
||||
|
||||
// Background colors
|
||||
declare var bgBlack: $npm$chalk$Chain;
|
||||
declare var bgRed: $npm$chalk$Chain;
|
||||
declare var bgGreen: $npm$chalk$Chain;
|
||||
declare var bgYellow: $npm$chalk$Chain;
|
||||
declare var bgBlue: $npm$chalk$Chain;
|
||||
declare var bgMagenta: $npm$chalk$Chain;
|
||||
declare var bgCyan: $npm$chalk$Chain;
|
||||
declare var bgWhite: $npm$chalk$Chain;
|
||||
}
|
|
@ -0,0 +1,99 @@
|
|||
// flow-typed signature: 8af4d93597d645140f12c00de2a323bc
|
||||
// flow-typed version: c6154227d1/chalk_v2.x.x/flow_>=v0.104.x
|
||||
|
||||
// From: https://github.com/chalk/chalk/blob/master/index.js.flow
|
||||
|
||||
declare module "chalk" {
|
||||
declare type TemplateStringsArray = $ReadOnlyArray<string>;
|
||||
|
||||
declare type Level = $Values<{
|
||||
None: 0,
|
||||
Basic: 1,
|
||||
Ansi256: 2,
|
||||
TrueColor: 3,
|
||||
...
|
||||
}>;
|
||||
|
||||
declare type ChalkOptions = {|
|
||||
enabled?: boolean,
|
||||
level?: Level
|
||||
|};
|
||||
|
||||
declare type ColorSupport = {|
|
||||
level: Level,
|
||||
hasBasic: boolean,
|
||||
has256: boolean,
|
||||
has16m: boolean
|
||||
|};
|
||||
|
||||
declare interface Chalk {
|
||||
(...text: string[]): string,
|
||||
(text: TemplateStringsArray, ...placeholders: string[]): string,
|
||||
constructor(options?: ChalkOptions): Chalk,
|
||||
enabled: boolean,
|
||||
level: Level,
|
||||
rgb(r: number, g: number, b: number): Chalk,
|
||||
hsl(h: number, s: number, l: number): Chalk,
|
||||
hsv(h: number, s: number, v: number): Chalk,
|
||||
hwb(h: number, w: number, b: number): Chalk,
|
||||
bgHex(color: string): Chalk,
|
||||
bgKeyword(color: string): Chalk,
|
||||
bgRgb(r: number, g: number, b: number): Chalk,
|
||||
bgHsl(h: number, s: number, l: number): Chalk,
|
||||
bgHsv(h: number, s: number, v: number): Chalk,
|
||||
bgHwb(h: number, w: number, b: number): Chalk,
|
||||
hex(color: string): Chalk,
|
||||
keyword(color: string): Chalk,
|
||||
|
||||
+reset: Chalk,
|
||||
+bold: Chalk,
|
||||
+dim: Chalk,
|
||||
+italic: Chalk,
|
||||
+underline: Chalk,
|
||||
+inverse: Chalk,
|
||||
+hidden: Chalk,
|
||||
+strikethrough: Chalk,
|
||||
|
||||
+visible: Chalk,
|
||||
|
||||
+black: Chalk,
|
||||
+red: Chalk,
|
||||
+green: Chalk,
|
||||
+yellow: Chalk,
|
||||
+blue: Chalk,
|
||||
+magenta: Chalk,
|
||||
+cyan: Chalk,
|
||||
+white: Chalk,
|
||||
+gray: Chalk,
|
||||
+grey: Chalk,
|
||||
+blackBright: Chalk,
|
||||
+redBright: Chalk,
|
||||
+greenBright: Chalk,
|
||||
+yellowBright: Chalk,
|
||||
+blueBright: Chalk,
|
||||
+magentaBright: Chalk,
|
||||
+cyanBright: Chalk,
|
||||
+whiteBright: Chalk,
|
||||
|
||||
+bgBlack: Chalk,
|
||||
+bgRed: Chalk,
|
||||
+bgGreen: Chalk,
|
||||
+bgYellow: Chalk,
|
||||
+bgBlue: Chalk,
|
||||
+bgMagenta: Chalk,
|
||||
+bgCyan: Chalk,
|
||||
+bgWhite: Chalk,
|
||||
+bgBlackBright: Chalk,
|
||||
+bgRedBright: Chalk,
|
||||
+bgGreenBright: Chalk,
|
||||
+bgYellowBright: Chalk,
|
||||
+bgBlueBright: Chalk,
|
||||
+bgMagentaBright: Chalk,
|
||||
+bgCyanBright: Chalk,
|
||||
+bgWhiteBrigh: Chalk,
|
||||
|
||||
supportsColor: ColorSupport
|
||||
}
|
||||
|
||||
declare module.exports: Chalk;
|
||||
}
|
|
@ -1,5 +1,5 @@
|
|||
// flow-typed signature: 6a5610678d4b01e13bbfbbc62bdaf583
|
||||
// flow-typed version: 3817bc6980/flow-bin_v0.x.x/flow_>=v0.25.x
|
||||
// flow-typed signature: 28fdff7f110e1c75efab63ff205dda30
|
||||
// flow-typed version: c6154227d1/flow-bin_v0.x.x/flow_>=v0.104.x
|
||||
|
||||
declare module "flow-bin" {
|
||||
declare module.exports: string;
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
// flow-typed signature: 47370d221401bec823c43c3598266e26
|
||||
// flow-typed version: ec28077c25/isomorphic-fetch_v2.x.x/flow_>=v0.25.x
|
||||
// flow-typed signature: 03bcd2195d27d9c7b8ea57265f6673cd
|
||||
// flow-typed version: c6154227d1/isomorphic-fetch_v2.x.x/flow_>=v0.104.x
|
||||
|
||||
|
||||
declare module 'isomorphic-fetch' {
|
||||
declare module.exports: (input: string | Request | URL, init?: RequestOptions) => Promise<Response>;
|
||||
declare module "isomorphic-fetch" {
|
||||
declare module.exports: (
|
||||
input: string | Request | URL,
|
||||
init?: RequestOptions
|
||||
) => Promise<Response>;
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// flow-typed signature: 62afff77b0be14fade0f13aee8bda9db
|
||||
// flow-typed version: 9823121349/jest_v24.x.x/flow_>=v0.39.x
|
||||
// flow-typed signature: 27f8467378a99b6130bd20f54f31a644
|
||||
// flow-typed version: 6cb9e99836/jest_v24.x.x/flow_>=v0.104.x
|
||||
|
||||
type JestMockFn<TArguments: $ReadOnlyArray<*>, TReturn> = {
|
||||
(...args: TArguments): TReturn,
|
||||
|
@ -22,7 +22,12 @@ type JestMockFn<TArguments: $ReadOnlyArray<*>, 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,
|
||||
...
|
||||
}>,
|
||||
...
|
||||
},
|
||||
/**
|
||||
* Resets all information stored in the mockFn.mock.calls and
|
||||
|
@ -95,14 +100,13 @@ type JestMockFn<TArguments: $ReadOnlyArray<*>, TReturn> = {
|
|||
* Sugar for jest.fn().mockImplementationOnce(() => Promise.reject(value))
|
||||
*/
|
||||
mockRejectedValueOnce(value: TReturn): JestMockFn<TArguments, Promise<any>>,
|
||||
...
|
||||
};
|
||||
|
||||
type JestAsymmetricEqualityType = {
|
||||
/**
|
||||
type JestAsymmetricEqualityType = { /**
|
||||
* A custom Jasmine equality tester
|
||||
*/
|
||||
asymmetricMatch(value: mixed): boolean,
|
||||
};
|
||||
asymmetricMatch(value: mixed): boolean, ... };
|
||||
|
||||
type JestCallsType = {
|
||||
allArgs(): mixed,
|
||||
|
@ -112,6 +116,7 @@ type JestCallsType = {
|
|||
first(): mixed,
|
||||
mostRecent(): mixed,
|
||||
reset(): void,
|
||||
...
|
||||
};
|
||||
|
||||
type JestClockType = {
|
||||
|
@ -119,11 +124,13 @@ type JestClockType = {
|
|||
mockDate(date: Date): void,
|
||||
tick(milliseconds?: number): void,
|
||||
uninstall(): void,
|
||||
...
|
||||
};
|
||||
|
||||
type JestMatcherResult = {
|
||||
message?: string | (() => string),
|
||||
pass: boolean,
|
||||
...
|
||||
};
|
||||
|
||||
type JestMatcher = (
|
||||
|
@ -142,6 +149,7 @@ type JestPromiseType = {
|
|||
* matcher can be chained. If the promise is rejected the assertion fails.
|
||||
*/
|
||||
resolves: JestExpectType,
|
||||
...
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -164,15 +172,14 @@ type JestStyledComponentsMatcherOptions = {
|
|||
media?: string,
|
||||
modifier?: string,
|
||||
supports?: string,
|
||||
...
|
||||
};
|
||||
|
||||
type JestStyledComponentsMatchersType = {
|
||||
toHaveStyleRule(
|
||||
type JestStyledComponentsMatchersType = { toHaveStyleRule(
|
||||
property: string,
|
||||
value: JestStyledComponentsMatcherValue,
|
||||
options?: JestStyledComponentsMatcherOptions
|
||||
): void,
|
||||
};
|
||||
): void, ... };
|
||||
|
||||
/**
|
||||
* Plugin: jest-enzyme
|
||||
|
@ -193,12 +200,12 @@ type EnzymeMatchersType = {
|
|||
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,27 +217,37 @@ type EnzymeMatchersType = {
|
|||
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 = {
|
||||
toBeDisabled(): void,
|
||||
toBeEnabled(): void,
|
||||
toBeEmpty(): void,
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
toBeInTheDOM(container?: HTMLElement): void,
|
||||
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(name: string, expectedValue?: string): void,
|
||||
toHaveAttribute(attr: string, value?: any): void,
|
||||
toHaveClass(...classNames: string[]): void,
|
||||
toHaveFocus(): void,
|
||||
toHaveFormValues(expectedValues: { [name: string]: any }): void,
|
||||
toHaveFormValues(expectedValues: { [name: string]: any, ... }): void,
|
||||
toHaveStyle(css: string): void,
|
||||
toHaveTextContent(
|
||||
content: string | RegExp,
|
||||
options?: { normalizeWhitespace: boolean }
|
||||
text: string | RegExp,
|
||||
options?: { normalizeWhitespace: boolean, ... }
|
||||
): void,
|
||||
toBeInTheDOM(): void,
|
||||
toHaveValue(value?: string | string[] | number): void,
|
||||
...
|
||||
};
|
||||
|
||||
// Jest JQuery Matchers: https://github.com/unindented/custom-jquery-matchers
|
||||
|
@ -245,7 +262,7 @@ type JestJQueryMatchersType = {
|
|||
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,
|
||||
|
@ -257,6 +274,7 @@ type JestJQueryMatchersType = {
|
|||
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
|
||||
|
@ -281,78 +299,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: 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`.
|
||||
*
|
||||
|
@ -362,42 +366,34 @@ type JestExtendedMatchersType = {
|
|||
* @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).
|
||||
*
|
||||
|
@ -405,144 +401,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.<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.
|
||||
*
|
||||
|
@ -550,13 +524,13 @@ 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.<String>} substring
|
||||
*/
|
||||
toIncludeMultiple(substring: string[]): void,
|
||||
...
|
||||
};
|
||||
|
||||
interface JestExpectType {
|
||||
|
@ -847,14 +821,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).
|
||||
|
@ -923,30 +895,34 @@ type JestObjectType = {
|
|||
* 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,
|
||||
fail: (error: Error) => void,
|
||||
|};
|
||||
|
||||
/** Runs this function after every test inside this context */
|
||||
declare function afterEach(
|
||||
fn: (done: () => void) => ?Promise<mixed>,
|
||||
fn: (done: JestDoneFn) => ?Promise<mixed>,
|
||||
timeout?: number
|
||||
): void;
|
||||
/** Runs this function before every test inside this context */
|
||||
declare function beforeEach(
|
||||
fn: (done: () => void) => ?Promise<mixed>,
|
||||
fn: (done: JestDoneFn) => ?Promise<mixed>,
|
||||
timeout?: number
|
||||
): void;
|
||||
/** Runs this function after all tests have finished inside this context */
|
||||
declare function afterAll(
|
||||
fn: (done: () => void) => ?Promise<mixed>,
|
||||
fn: (done: JestDoneFn) => ?Promise<mixed>,
|
||||
timeout?: number
|
||||
): void;
|
||||
/** Runs this function before any tests have started inside this context */
|
||||
declare function beforeAll(
|
||||
fn: (done: () => void) => ?Promise<mixed>,
|
||||
fn: (done: JestDoneFn) => ?Promise<mixed>,
|
||||
timeout?: number
|
||||
): void;
|
||||
|
||||
|
@ -956,17 +932,14 @@ 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
|
||||
*
|
||||
|
@ -979,6 +952,7 @@ declare var describe: {
|
|||
fn?: (...args: Array<any>) => ?Promise<mixed>,
|
||||
timeout?: number
|
||||
) => void,
|
||||
...
|
||||
};
|
||||
|
||||
/** An individual test unit */
|
||||
|
@ -992,10 +966,9 @@ declare var it: {
|
|||
*/
|
||||
(
|
||||
name: JestTestName,
|
||||
fn?: (done: () => void) => ?Promise<mixed>,
|
||||
fn?: (done: JestDoneFn) => ?Promise<mixed>,
|
||||
timeout?: number
|
||||
): void,
|
||||
|
||||
/**
|
||||
* Only run this test
|
||||
*
|
||||
|
@ -1003,20 +976,20 @@ declare var it: {
|
|||
* @param {Function} Test
|
||||
* @param {number} Timeout for the test, in milliseconds.
|
||||
*/
|
||||
only(
|
||||
only: {|
|
||||
(
|
||||
name: JestTestName,
|
||||
fn?: (done: () => void) => ?Promise<mixed>,
|
||||
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,
|
||||
},
|
||||
|
||||
) => void
|
||||
|},
|
||||
/**
|
||||
* Skip running this test
|
||||
*
|
||||
|
@ -1026,17 +999,15 @@ declare var it: {
|
|||
*/
|
||||
skip(
|
||||
name: JestTestName,
|
||||
fn?: (done: () => void) => ?Promise<mixed>,
|
||||
fn?: (done: JestDoneFn) => ?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
|
||||
*
|
||||
|
@ -1046,10 +1017,9 @@ declare var it: {
|
|||
*/
|
||||
concurrent(
|
||||
name: JestTestName,
|
||||
fn?: (done: () => void) => ?Promise<mixed>,
|
||||
fn?: (done: JestDoneFn) => ?Promise<mixed>,
|
||||
timeout?: number
|
||||
): void,
|
||||
|
||||
/**
|
||||
* each runs this test against array of argument arrays per each run
|
||||
*
|
||||
|
@ -1062,11 +1032,12 @@ declare var it: {
|
|||
fn?: (...args: Array<any>) => ?Promise<mixed>,
|
||||
timeout?: number
|
||||
) => void,
|
||||
...
|
||||
};
|
||||
|
||||
declare function fit(
|
||||
name: JestTestName,
|
||||
fn: (done: () => void) => ?Promise<mixed>,
|
||||
fn: (done: JestDoneFn) => ?Promise<mixed>,
|
||||
timeout?: number
|
||||
): void;
|
||||
/** An individual test unit */
|
||||
|
@ -1081,11 +1052,32 @@ 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;
|
||||
|
@ -1122,6 +1114,7 @@ type JestPrettyFormatPlugin = {
|
|||
colors: JestPrettyFormatColors
|
||||
) => string,
|
||||
test: any => boolean,
|
||||
...
|
||||
};
|
||||
|
||||
type JestPrettyFormatPlugins = Array<JestPrettyFormatPlugin>;
|
||||
|
@ -1138,9 +1131,8 @@ declare var expect: {
|
|||
JestJQueryMatchersType &
|
||||
JestStyledComponentsMatchersType &
|
||||
JestExtendedMatchersType,
|
||||
|
||||
/** 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,
|
||||
|
@ -1154,10 +1146,12 @@ declare var expect: {
|
|||
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
|
||||
|
@ -1181,7 +1175,8 @@ declare var jasmine: {
|
|||
createSpyObj(
|
||||
baseName: string,
|
||||
methodNames: Array<string>
|
||||
): { [methodName: string]: JestSpyType },
|
||||
): { [methodName: string]: JestSpyType, ... },
|
||||
objectContaining(value: Object): Object,
|
||||
stringMatching(value: string): string,
|
||||
...
|
||||
};
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// flow-typed signature: 0163683fe464be718f5e440cbb72d8b0
|
||||
// flow-typed version: 62c71f6105/object-assign_v4.x.x/flow_>=v0.25.x
|
||||
// flow-typed signature: f3107da4bbfb4bddf9eb6bd0c81bd577
|
||||
// flow-typed version: c6154227d1/object-assign_v4.x.x/flow_>=v0.104.x
|
||||
|
||||
declare module "object-assign" {
|
||||
declare module.exports: Object$Assign;
|
||||
|
|
|
@ -0,0 +1,20 @@
|
|||
// flow-typed signature: 8b21843f43134917177d82a3b993b609
|
||||
// flow-typed version: c6154227d1/rimraf_v2.x.x/flow_>=v0.104.x
|
||||
|
||||
declare module 'rimraf' {
|
||||
declare type Options = {
|
||||
maxBusyTries?: number,
|
||||
emfileWait?: number,
|
||||
glob?: boolean,
|
||||
disableGlob?: boolean,
|
||||
...
|
||||
};
|
||||
|
||||
declare type Callback = (err: ?Error, path: ?string) => void;
|
||||
|
||||
declare module.exports: {
|
||||
(f: string, opts?: Options | Callback, callback?: Callback): void,
|
||||
sync(path: string, opts?: Options): void,
|
||||
...
|
||||
};
|
||||
}
|
Loading…
Reference in New Issue