@morgan-stanley/ts-mocking-bird
Advanced tools
@@ -1,2 +0,2 @@ | ||
import type { afterAll as vitestAfterAll, afterEach as vitestAfterEach, beforeAll as vitestBeforeAll, beforeEach as vitestBeforeEach } from 'vitest'; | ||
import type { afterAll as vitestAfterAll, afterEach as vitestAfterEach, beforeAll as vitestBeforeAll, beforeEach as vitestBeforeEach } from '../mock/framework.contracts'; | ||
export interface IImportReplacement<T extends {}> { | ||
@@ -16,4 +16,4 @@ package: T; | ||
export declare function replaceProperties<T extends Record<string, any>>(target: T, mocks: Partial<T>, functions?: { | ||
beforeAll: typeof vitestBeforeAll; | ||
afterAll: typeof vitestAfterAll; | ||
beforeAll: vitestBeforeAll; | ||
afterAll: vitestAfterAll; | ||
}): void; | ||
@@ -59,5 +59,5 @@ export declare const mockImports: typeof replaceProperties; | ||
export declare function replacePropertiesBeforeEach(callback: () => IImportReplacement<any>[], functions?: { | ||
beforeEach: typeof vitestBeforeEach; | ||
afterEach: typeof vitestAfterEach; | ||
beforeEach: vitestBeforeEach; | ||
afterEach: vitestAfterEach; | ||
}): void; | ||
export declare const mockImportsBeforeEach: typeof replacePropertiesBeforeEach; |
@@ -24,1 +24,7 @@ export interface ExpectExtend { | ||
} | ||
type TestLifecycleListener = () => Promise<void> | void; | ||
export type afterAll = (fn: TestLifecycleListener, timeout?: number) => void; | ||
export type afterEach = (fn: TestLifecycleListener, timeout?: number) => void; | ||
export type beforeAll = (fn: TestLifecycleListener, timeout?: number) => void; | ||
export type beforeEach = (fn: TestLifecycleListener, timeout?: number) => void; | ||
export {}; |
@@ -6,3 +6,3 @@ import type { | ||
beforeEach as vitestBeforeEach, | ||
} from 'vitest'; | ||
} from '../mock/framework.contracts'; | ||
@@ -54,3 +54,3 @@ /* eslint-disable @typescript-eslint/ban-types */ | ||
mocks: Partial<T>, | ||
functions?: { beforeAll: typeof vitestBeforeAll; afterAll: typeof vitestAfterAll }, | ||
functions?: { beforeAll: vitestBeforeAll; afterAll: vitestAfterAll }, | ||
) { | ||
@@ -111,3 +111,3 @@ const descriptors = getDescriptors(target, mocks); | ||
callback: () => IImportReplacement<any>[], | ||
functions?: { beforeEach: typeof vitestBeforeEach; afterEach: typeof vitestAfterEach }, | ||
functions?: { beforeEach: vitestBeforeEach; afterEach: vitestAfterEach }, | ||
) { | ||
@@ -114,0 +114,0 @@ const importCopies: IImportCopy<any>[] = []; |
@@ -29,1 +29,8 @@ // We copy types from frameworks here so we have no dependency on jest, jasmine or vitest when running in a consuming project that will not have types for these frameworks. | ||
} | ||
type TestLifecycleListener = () => Promise<void> | void; | ||
export type afterAll = (fn: TestLifecycleListener, timeout?: number) => void; | ||
export type afterEach = (fn: TestLifecycleListener, timeout?: number) => void; | ||
export type beforeAll = (fn: TestLifecycleListener, timeout?: number) => void; | ||
export type beforeEach = (fn: TestLifecycleListener, timeout?: number) => void; |
{ | ||
"name": "@morgan-stanley/ts-mocking-bird", | ||
"version": "1.3.1", | ||
"version": "1.3.2", | ||
"description": "A fully type safe mocking, call verification and import replacement library for jasmine and jest", | ||
@@ -5,0 +5,0 @@ "license": "Apache-2.0", |
Sorry, the diff of this file is not supported yet
198179
0.38%3224
0.34%