mirror of
https://github.com/FlipsideCrypto/DefinitelyTyped.git
synced 2026-02-06 10:56:53 +00:00
fix(jest): The mock function factory argument is a callback (#36045)
This commit is contained in:
parent
461105b38c
commit
5ce5329b56
9
types/jest/index.d.ts
vendored
9
types/jest/index.d.ts
vendored
@ -1,6 +1,6 @@
|
||||
// Type definitions for Jest 24.0
|
||||
// Project: https://jestjs.io
|
||||
// Definitions by: Asana <https://asana.com>
|
||||
// Project: https://jestjs.io/
|
||||
// Definitions by: Asana (https://asana.com)
|
||||
// Ivo Stratev <https://github.com/NoHomey>
|
||||
// jwbay <https://github.com/jwbay>
|
||||
// Alexey Svetliakov <https://github.com/asvetliakov>
|
||||
@ -20,6 +20,7 @@
|
||||
// Antoine Brault <https://github.com/antoinebrault>
|
||||
// Jeroen Claassens <https://github.com/favna>
|
||||
// Gregor Stamać <https://github.com/gstamac>
|
||||
// ExE Boss <https://github.com/ExE-Boss>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 3.0
|
||||
|
||||
@ -106,7 +107,7 @@ declare namespace jest {
|
||||
/**
|
||||
* Mocks a module with an auto-mocked version when it is being required.
|
||||
*/
|
||||
function doMock(moduleName: string, factory?: any, options?: MockOptions): typeof jest;
|
||||
function doMock(moduleName: string, factory?: () => unknown, options?: MockOptions): typeof jest;
|
||||
/**
|
||||
* Indicates that the module system should never return a mocked version
|
||||
* of the specified module from require() (e.g. that it should always return the real module).
|
||||
@ -135,7 +136,7 @@ declare namespace jest {
|
||||
/**
|
||||
* Mocks a module with an auto-mocked version when it is being required.
|
||||
*/
|
||||
function mock(moduleName: string, factory?: any, options?: MockOptions): typeof jest;
|
||||
function mock(moduleName: string, factory?: () => unknown, options?: MockOptions): typeof jest;
|
||||
/**
|
||||
* Returns the actual module instead of a mock, bypassing all checks on
|
||||
* whether the module should receive a mock implementation or not.
|
||||
|
||||
@ -2,10 +2,7 @@
|
||||
"extends": "dtslint/dt.json",
|
||||
"rules": {
|
||||
// TODOs
|
||||
"dt-header": false,
|
||||
"npm-naming": false,
|
||||
"no-mergeable-namespace": false,
|
||||
"no-void-expression": false,
|
||||
"no-unnecessary-generics": false
|
||||
}
|
||||
}
|
||||
|
||||
11
types/jest/v16/index.d.ts
vendored
11
types/jest/v16/index.d.ts
vendored
@ -1,6 +1,9 @@
|
||||
// Type definitions for Jest 16.0.0
|
||||
// Type definitions for Jest 16.0
|
||||
// Project: http://facebook.github.io/jest/
|
||||
// Definitions by: Asana <https://asana.com>, Ivo Stratev <https://github.com/NoHomey>, jwbay <https://github.com/jwbay>
|
||||
// Definitions by: Asana (https://asana.com)
|
||||
// Ivo Stratev <https://github.com/NoHomey>
|
||||
// jwbay <https://github.com/jwbay>
|
||||
// ExE Boss <https://github.com/ExE-Boss>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare var beforeAll: jest.Lifecycle;
|
||||
@ -40,7 +43,7 @@ declare namespace jest {
|
||||
/** Disables automatic mocking in the module loader. */
|
||||
function disableAutomock(): typeof jest;
|
||||
/** Mocks a module with an auto-mocked version when it is being required. */
|
||||
function doMock(moduleName: string): typeof jest;
|
||||
function doMock(moduleName: string, factory?: () => any, options?: MockOptions): typeof jest;
|
||||
/** Indicates that the module system should never return a mocked version of the specified module from require() (e.g. that it should always return the real module). */
|
||||
function dontMock(moduleName: string): typeof jest;
|
||||
/** Enables automatic mocking in the module loader. */
|
||||
@ -52,7 +55,7 @@ declare namespace jest {
|
||||
/** Returns whether the given function is a mock function. */
|
||||
function isMockFunction(fn: any): fn is Mock<any>;
|
||||
/** Mocks a module with an auto-mocked version when it is being required. */
|
||||
function mock(moduleName: string, factory?: any, options?: MockOptions): typeof jest;
|
||||
function mock(moduleName: string, factory?: () => any, options?: MockOptions): 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 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. */
|
||||
|
||||
@ -7,7 +7,6 @@
|
||||
"ban-types": false,
|
||||
"callable-types": false,
|
||||
"comment-format": false,
|
||||
"dt-header": false,
|
||||
"eofline": false,
|
||||
"export-just-namespace": false,
|
||||
"import-spacing": false,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user