diff --git a/types/jest/index.d.ts b/types/jest/index.d.ts index 7d1a7d70ca..96748c1b40 100644 --- a/types/jest/index.d.ts +++ b/types/jest/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for Jest 24.0 -// Project: https://jestjs.io -// Definitions by: Asana +// Project: https://jestjs.io/ +// Definitions by: Asana (https://asana.com) // Ivo Stratev // jwbay // Alexey Svetliakov @@ -20,6 +20,7 @@ // Antoine Brault // Jeroen Claassens // Gregor Stamać +// 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. diff --git a/types/jest/tslint.json b/types/jest/tslint.json index e7a54c4021..35d6c07794 100644 --- a/types/jest/tslint.json +++ b/types/jest/tslint.json @@ -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 } } diff --git a/types/jest/v16/index.d.ts b/types/jest/v16/index.d.ts index c1282c2c74..3881a3aafd 100644 --- a/types/jest/v16/index.d.ts +++ b/types/jest/v16/index.d.ts @@ -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 , Ivo Stratev , jwbay +// Definitions by: Asana (https://asana.com) +// Ivo Stratev +// jwbay +// 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; /** 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. */ diff --git a/types/jest/v16/tslint.json b/types/jest/v16/tslint.json index a41bf5d19a..a0357daa61 100644 --- a/types/jest/v16/tslint.json +++ b/types/jest/v16/tslint.json @@ -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,