@types/jest
Advanced tools
Comparing version 26.0.19 to 27.5.2
@@ -1,2 +0,2 @@ | ||
// Type definitions for Jest 26.0 | ||
// Type definitions for Jest 27.5 | ||
// Project: https://jestjs.io/ | ||
@@ -14,3 +14,2 @@ // Definitions by: Asana (https://asana.com) | ||
// Ahn <https://github.com/ahnpnl> | ||
// Josh Goldberg <https://github.com/joshuakgoldberg> | ||
// Jeff Lau <https://github.com/UselessPickles> | ||
@@ -28,5 +27,6 @@ // Andrew Makarov <https://github.com/r3nya> | ||
// Jason Yu <https://github.com/ycmjason> | ||
// Devansh Jethmalani <https://github.com/devanshj> | ||
// Pawel Fajfer <https://github.com/pawfa> | ||
// Regev Brody <https://github.com/regevbr> | ||
// Alexandre Germain <https://github.com/gerkindev> | ||
// Adam Jones <https://github.com/domdomegg> | ||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped | ||
@@ -78,6 +78,2 @@ // Minimum TypeScript Version: 3.8 | ||
/** | ||
* Provides a way to add Jasmine-compatible matchers into your Jest context. | ||
*/ | ||
function addMatchers(matchers: jasmine.CustomMatcherFactories): typeof jest; | ||
/** | ||
* Disables automatic mocking in the module loader. | ||
@@ -155,3 +151,4 @@ */ | ||
*/ | ||
function doMock(moduleName: string, factory?: () => unknown, options?: MockOptions): typeof jest; | ||
// tslint:disable-next-line no-unnecessary-generics | ||
function doMock<T = unknown>(moduleName: string, factory?: () => T, options?: MockOptions): typeof jest; | ||
/** | ||
@@ -187,4 +184,24 @@ * Indicates that the module system should never return a mocked version | ||
*/ | ||
function mock(moduleName: string, factory?: () => unknown, options?: MockOptions): typeof jest; | ||
// tslint:disable-next-line no-unnecessary-generics | ||
function mock<T = unknown>(moduleName: string, factory?: () => T, options?: MockOptions): typeof jest; | ||
/** | ||
* The mocked test helper provides typings on your mocked modules and even | ||
* their deep methods, based on the typing of its source. It makes use of | ||
* the latest TypeScript feature, so you even have argument types | ||
* completion in the IDE (as opposed to jest.MockInstance). | ||
* | ||
* Note: while it needs to be a function so that input type is changed, the helper itself does nothing else than returning the given input value. | ||
*/ | ||
function mocked<T>(item: T, deep?: false): MaybeMocked<T>; | ||
/** | ||
* The mocked test helper provides typings on your mocked modules and even | ||
* their deep methods, based on the typing of its source. It makes use of | ||
* the latest TypeScript feature, so you even have argument types | ||
* completion in the IDE (as opposed to jest.MockInstance). | ||
* | ||
* Note: while it needs to be a function so that input type is changed, the helper itself does nothing else than returning the given input value. | ||
*/ | ||
function mocked<T>(item: T, deep: true): MaybeMockedDeep<T>; | ||
/** | ||
* Returns the actual module instead of a mock, bypassing all checks on | ||
@@ -194,3 +211,3 @@ * whether the module should receive a mock implementation or not. | ||
// tslint:disable-next-line: no-unnecessary-generics | ||
function requireActual<TModule = any>(moduleName: string): TModule; | ||
function requireActual<TModule extends {} = any>(moduleName: string): TModule; | ||
/** | ||
@@ -201,3 +218,3 @@ * Returns a mock module instead of the actual module, bypassing all checks | ||
// tslint:disable-next-line: no-unnecessary-generics | ||
function requireMock<TModule = any>(moduleName: string): TModule; | ||
function requireMock<TModule extends {} = any>(moduleName: string): TModule; | ||
/** | ||
@@ -207,7 +224,2 @@ * Resets the module registry - the cache of all required modules. This is | ||
*/ | ||
function resetModuleRegistry(): typeof jest; | ||
/** | ||
* Resets the module registry - the cache of all required modules. This is | ||
* useful to isolate modules where local state might conflict between tests. | ||
*/ | ||
function resetModules(): typeof jest; | ||
@@ -226,2 +238,4 @@ /** | ||
* Exhausts tasks queued by setImmediate(). | ||
* > Note: This function is only available when using modern fake timers | ||
* > implementation | ||
*/ | ||
@@ -234,3 +248,5 @@ function runAllImmediates(): typeof jest; | ||
/** | ||
* Exhausts the macro-task queue (i.e., all tasks queued by setTimeout() and setInterval()). | ||
* Exhausts both the macro-task queue (i.e., all tasks queued by setTimeout(), | ||
* setInterval(), and setImmediate()) and the micro-task queue (usually interfaced | ||
* in node via process.nextTick). | ||
*/ | ||
@@ -246,7 +262,2 @@ function runAllTimers(): typeof jest; | ||
/** | ||
* (renamed to `advanceTimersByTime` in Jest 21.3.0+) Executes only the macro | ||
* task queue (i.e. all tasks queued by setTimeout() or setInterval() and setImmediate()). | ||
*/ | ||
function runTimersToTime(msToRun: number): typeof jest; | ||
/** | ||
* Advances all timers by msToRun milliseconds. All pending "macro-tasks" that have been | ||
@@ -332,5 +343,33 @@ * queued via setTimeout() or setInterval(), and would be executed within this timeframe | ||
interface MockOptions { | ||
virtual?: boolean; | ||
virtual?: boolean | undefined; | ||
} | ||
type MockableFunction = (...args: any[]) => any; | ||
type MethodKeysOf<T> = { [K in keyof T]: T[K] extends MockableFunction ? K : never }[keyof T]; | ||
type PropertyKeysOf<T> = { [K in keyof T]: T[K] extends MockableFunction ? never : K }[keyof T]; | ||
type ArgumentsOf<T> = T extends (...args: infer A) => any ? A : never; | ||
type ConstructorArgumentsOf<T> = T extends new (...args: infer A) => any ? A : never; | ||
interface MockWithArgs<T extends MockableFunction> extends MockInstance<ReturnType<T>, ArgumentsOf<T>> { | ||
new (...args: ConstructorArgumentsOf<T>): T; | ||
(...args: ArgumentsOf<T>): ReturnType<T>; | ||
} | ||
type MaybeMockedConstructor<T> = T extends new (...args: any[]) => infer R | ||
? MockInstance<R, ConstructorArgumentsOf<T>> | ||
: T; | ||
type MockedFn<T extends MockableFunction> = MockWithArgs<T> & { [K in keyof T]: T[K] }; | ||
type MockedFunctionDeep<T extends MockableFunction> = MockWithArgs<T> & MockedObjectDeep<T>; | ||
type MockedObject<T> = MaybeMockedConstructor<T> & { | ||
[K in MethodKeysOf<T>]: T[K] extends MockableFunction ? MockedFn<T[K]> : T[K]; | ||
} & { [K in PropertyKeysOf<T>]: T[K] }; | ||
type MockedObjectDeep<T> = MaybeMockedConstructor<T> & { | ||
[K in MethodKeysOf<T>]: T[K] extends MockableFunction ? MockedFunctionDeep<T[K]> : T[K]; | ||
} & { [K in PropertyKeysOf<T>]: MaybeMockedDeep<T[K]> }; | ||
type MaybeMockedDeep<T> = T extends MockableFunction | ||
? MockedFunctionDeep<T> | ||
: T extends object // eslint-disable-line @typescript-eslint/ban-types | ||
? MockedObjectDeep<T> | ||
: T; | ||
// eslint-disable-next-line @typescript-eslint/ban-types | ||
type MaybeMocked<T> = T extends MockableFunction ? MockedFn<T> : T extends object ? MockedObject<T> : T; | ||
type EmptyFunction = () => void; | ||
@@ -354,5 +393,6 @@ type ArgsType<T> = T extends (...args: infer A) => any ? A : never; | ||
type ProvidesCallback = (cb: DoneCallback) => any; | ||
type ProvidesCallback = ((cb: DoneCallback) => void | undefined) | (() => Promise<unknown>); | ||
type ProvidesHookCallback = (() => any) | ProvidesCallback; | ||
type Lifecycle = (fn: ProvidesCallback, timeout?: number) => any; | ||
type Lifecycle = (fn: ProvidesHookCallback, timeout?: number) => any; | ||
@@ -462,31 +502,2 @@ interface FunctionLike { | ||
type PrintLabel = (string: string) => string; | ||
type MatcherHintColor = (arg: string) => string; | ||
interface MatcherHintOptions { | ||
comment?: string; | ||
expectedColor?: MatcherHintColor; | ||
isDirectExpectCall?: boolean; | ||
isNot?: boolean; | ||
promise?: string; | ||
receivedColor?: MatcherHintColor; | ||
secondArgument?: string; | ||
secondArgumentColor?: MatcherHintColor; | ||
} | ||
interface ChalkFunction { | ||
(text: TemplateStringsArray, ...placeholders: any[]): string; | ||
(...text: any[]): string; | ||
} | ||
interface ChalkColorSupport { | ||
level: 0 | 1 | 2 | 3; | ||
hasBasic: boolean; | ||
has256: boolean; | ||
has16m: boolean; | ||
} | ||
type MatcherColorFn = ChalkFunction & { supportsColor: ChalkColorSupport }; | ||
type EqualityTester = (a: any, b: any) => boolean | undefined; | ||
@@ -505,37 +516,3 @@ | ||
readonly currentTestName: string; | ||
utils: { | ||
readonly EXPECTED_COLOR: MatcherColorFn; | ||
readonly RECEIVED_COLOR: MatcherColorFn; | ||
readonly INVERTED_COLOR: MatcherColorFn; | ||
readonly BOLD_WEIGHT: MatcherColorFn; | ||
readonly DIM_COLOR: MatcherColorFn; | ||
readonly SUGGEST_TO_CONTAIN_EQUAL: string; | ||
diff(a: any, b: any, options?: import("jest-diff").DiffOptions): string | null; | ||
ensureActualIsNumber(actual: any, matcherName: string, options?: MatcherHintOptions): void; | ||
ensureExpectedIsNumber(actual: any, matcherName: string, options?: MatcherHintOptions): void; | ||
ensureNoExpected(actual: any, matcherName: string, options?: MatcherHintOptions): void; | ||
ensureNumbers(actual: any, expected: any, matcherName: string, options?: MatcherHintOptions): void; | ||
ensureExpectedIsNonNegativeInteger(expected: any, matcherName: string, options?: MatcherHintOptions): void; | ||
matcherHint( | ||
matcherName: string, | ||
received?: string, | ||
expected?: string, | ||
options?: MatcherHintOptions | ||
): string; | ||
matcherErrorMessage( | ||
hint: string, | ||
generic: string, | ||
specific: string | ||
): string; | ||
pluralize(word: string, count: number): string; | ||
printReceived(object: any): string; | ||
printExpected(value: any): string; | ||
printWithType(name: string, value: any, print: (value: any) => string): string; | ||
stringify(object: {}, maxDepth?: number): string; | ||
highlightTrailingWhitespace(text: string): string; | ||
printDiffOrStringify(expected: any, received: any, expectedLabel: string, receivedLabel: string, expand: boolean): string; | ||
getLabelPrinter(...strings: string[]): PrintLabel; | ||
utils: typeof import('jest-matcher-utils') & { | ||
iterableEquality: EqualityTester; | ||
@@ -610,3 +587,3 @@ subsetEquality: EqualityTester; | ||
expectedAssertionsNumber: number; | ||
isExpectingAssertions?: boolean; | ||
isExpectingAssertions?: boolean | undefined; | ||
suppressedErrors: Error[]; | ||
@@ -988,3 +965,3 @@ testPath: string; | ||
* | ||
* expect(desiredHouse).toMatchObject<House>(...standardHouse, kitchen: {area: 20}) // wherein standardHouse is some base object of type House | ||
* expect(desiredHouse).toMatchObject<House>({...standardHouse, kitchen: {area: 20}}) // wherein standardHouse is some base object of type House | ||
*/ | ||
@@ -1092,6 +1069,3 @@ // tslint:disable-next-line: no-unnecessary-generics | ||
ExtendedExpectFunction<TMatchers>; | ||
/** | ||
* Construct a type with the properties of T except for those in type K. | ||
*/ | ||
type Omit<T, K extends keyof any> = Pick<T, Exclude<keyof T, K>>; | ||
type NonPromiseMatchers<T extends JestMatchersShape<any>> = Omit<T, 'resolves' | 'rejects' | 'not'>; | ||
@@ -1210,3 +1184,3 @@ type PromiseMatchers<T extends JestMatchersShape> = Omit<T['resolves'], 'not'>; | ||
*/ | ||
getMockImplementation(): (...args: Y) => T | undefined; | ||
getMockImplementation(): ((...args: Y) => T) | undefined; | ||
/** | ||
@@ -1358,2 +1332,3 @@ * Accepts a function that should be used as the implementation of the mock. The mock itself will still record | ||
interface MockContext<T, Y extends any[]> { | ||
lastCall: Y; | ||
calls: Y[]; | ||
@@ -1396,3 +1371,2 @@ instances: T[]; | ||
function addCustomEqualityTester(equalityTester: CustomEqualityTester): void; | ||
function addMatchers(matchers: CustomMatcherFactories): void; | ||
function stringMatching(value: string | RegExp): Any; | ||
@@ -1399,0 +1373,0 @@ |
{ | ||
"name": "@types/jest", | ||
"version": "26.0.19", | ||
"version": "27.5.2", | ||
"description": "TypeScript definitions for Jest", | ||
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/jest", | ||
"license": "MIT", | ||
@@ -58,7 +59,2 @@ "contributors": [ | ||
{ | ||
"name": "Josh Goldberg", | ||
"url": "https://github.com/joshuakgoldberg", | ||
"githubUsername": "joshuakgoldberg" | ||
}, | ||
{ | ||
"name": "Jeff Lau", | ||
@@ -124,7 +120,2 @@ "url": "https://github.com/UselessPickles", | ||
{ | ||
"name": "Devansh Jethmalani", | ||
"url": "https://github.com/devanshj", | ||
"githubUsername": "devanshj" | ||
}, | ||
{ | ||
"name": "Pawel Fajfer", | ||
@@ -138,2 +129,12 @@ "url": "https://github.com/pawfa", | ||
"githubUsername": "regevbr" | ||
}, | ||
{ | ||
"name": "Alexandre Germain", | ||
"url": "https://github.com/gerkindev", | ||
"githubUsername": "gerkindev" | ||
}, | ||
{ | ||
"name": "Adam Jones", | ||
"url": "https://github.com/domdomegg", | ||
"githubUsername": "domdomegg" | ||
} | ||
@@ -150,7 +151,13 @@ ], | ||
"dependencies": { | ||
"jest-diff": "^26.0.0", | ||
"pretty-format": "^26.0.0" | ||
"jest-matcher-utils": "^27.0.0", | ||
"pretty-format": "^27.0.0" | ||
}, | ||
"typesPublisherContentHash": "9c614362fdae055982ddc1ec8ad301e1487417327bdbb6ea1ff078aea83b81b9", | ||
"typeScriptVersion": "3.8" | ||
"typesPublisherContentHash": "c3648d4e7b9fefc43ee9c0405029ec31bfcae987fdaa936b2eb281722391fd90", | ||
"typeScriptVersion": "3.9", | ||
"exports": { | ||
".": { | ||
"types": "./index.d.ts" | ||
}, | ||
"./package.json": "./package.json" | ||
} | ||
} |
@@ -11,4 +11,4 @@ # Installation | ||
### Additional Details | ||
* Last updated: Thu, 10 Dec 2020 22:33:57 GMT | ||
* Dependencies: [@types/jest-diff](https://npmjs.com/package/@types/jest-diff), [@types/pretty-format](https://npmjs.com/package/@types/pretty-format) | ||
* Last updated: Wed, 01 Jun 2022 18:01:29 GMT | ||
* Dependencies: [@types/jest-matcher-utils](https://npmjs.com/package/@types/jest-matcher-utils), [@types/pretty-format](https://npmjs.com/package/@types/pretty-format) | ||
* Global values: `afterAll`, `afterEach`, `beforeAll`, `beforeEach`, `describe`, `expect`, `fail`, `fdescribe`, `fit`, `it`, `jasmine`, `jest`, `pending`, `spyOn`, `test`, `xdescribe`, `xit`, `xtest` | ||
@@ -18,2 +18,2 @@ | ||
These definitions were written by [Asana (https://asana.com) | ||
// Ivo Stratev](https://github.com/NoHomey), [jwbay](https://github.com/jwbay), [Alexey Svetliakov](https://github.com/asvetliakov), [Alex Jover Morales](https://github.com/alexjoverm), [Allan Lukwago](https://github.com/epicallan), [Ika](https://github.com/ikatyang), [Waseem Dahman](https://github.com/wsmd), [Jamie Mason](https://github.com/JamieMason), [Douglas Duteil](https://github.com/douglasduteil), [Ahn](https://github.com/ahnpnl), [Josh Goldberg](https://github.com/joshuakgoldberg), [Jeff Lau](https://github.com/UselessPickles), [Andrew Makarov](https://github.com/r3nya), [Martin Hochel](https://github.com/hotell), [Sebastian Sebald](https://github.com/sebald), [Andy](https://github.com/andys8), [Antoine Brault](https://github.com/antoinebrault), [Gregor Stamać](https://github.com/gstamac), [ExE Boss](https://github.com/ExE-Boss), [Alex Bolenok](https://github.com/quassnoi), [Mario Beltrán Alarcón](https://github.com/Belco90), [Tony Hallett](https://github.com/tonyhallett), [Jason Yu](https://github.com/ycmjason), [Devansh Jethmalani](https://github.com/devanshj), [Pawel Fajfer](https://github.com/pawfa), and [Regev Brody](https://github.com/regevbr). | ||
// Ivo Stratev](https://github.com/NoHomey), [jwbay](https://github.com/jwbay), [Alexey Svetliakov](https://github.com/asvetliakov), [Alex Jover Morales](https://github.com/alexjoverm), [Allan Lukwago](https://github.com/epicallan), [Ika](https://github.com/ikatyang), [Waseem Dahman](https://github.com/wsmd), [Jamie Mason](https://github.com/JamieMason), [Douglas Duteil](https://github.com/douglasduteil), [Ahn](https://github.com/ahnpnl), [Jeff Lau](https://github.com/UselessPickles), [Andrew Makarov](https://github.com/r3nya), [Martin Hochel](https://github.com/hotell), [Sebastian Sebald](https://github.com/sebald), [Andy](https://github.com/andys8), [Antoine Brault](https://github.com/antoinebrault), [Gregor Stamać](https://github.com/gstamac), [ExE Boss](https://github.com/ExE-Boss), [Alex Bolenok](https://github.com/quassnoi), [Mario Beltrán Alarcón](https://github.com/Belco90), [Tony Hallett](https://github.com/tonyhallett), [Jason Yu](https://github.com/ycmjason), [Pawel Fajfer](https://github.com/pawfa), [Regev Brody](https://github.com/regevbr), [Alexandre Germain](https://github.com/gerkindev), and [Adam Jones](https://github.com/domdomegg). |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No website
QualityPackage does not have a website.
Found 1 instance in 1 package
71367
0
1448
+ Addedjest-matcher-utils@^27.0.0
+ Addedansi-styles@5.2.0(transitive)
+ Addeddiff-sequences@27.5.1(transitive)
+ Addedjest-diff@27.5.1(transitive)
+ Addedjest-get-type@27.5.1(transitive)
+ Addedjest-matcher-utils@27.5.1(transitive)
+ Addedpretty-format@27.5.1(transitive)
- Removedjest-diff@^26.0.0
- Removed@jest/types@26.6.2(transitive)
- Removed@types/istanbul-lib-coverage@2.0.6(transitive)
- Removed@types/istanbul-lib-report@3.0.3(transitive)
- Removed@types/istanbul-reports@3.0.4(transitive)
- Removed@types/node@22.5.4(transitive)
- Removed@types/yargs@15.0.19(transitive)
- Removed@types/yargs-parser@21.0.3(transitive)
- Removeddiff-sequences@26.6.2(transitive)
- Removedjest-diff@26.6.2(transitive)
- Removedjest-get-type@26.3.0(transitive)
- Removedpretty-format@26.6.2(transitive)
- Removedundici-types@6.19.8(transitive)
Updatedpretty-format@^27.0.0