@morgan-stanley/ts-mocking-bird
Advanced tools
Comparing version 1.3.0 to 1.3.1
@@ -247,22 +247,2 @@ export type OperatorFunction<T, C extends ConstructorFunction<T>> = (value: IMocked<T, C>) => IMocked<T, C>; | ||
} | ||
/** | ||
* Copied here from Jest types to avoid the need for consuming projects to install Jest types | ||
*/ | ||
export interface IJestCustomMatcherResult { | ||
pass: boolean; | ||
message: () => string; | ||
} | ||
/** | ||
* Copied here from Jasmine types to avoid the need for consuming projects to install Jasmine types | ||
*/ | ||
export interface IJasmineCustomMatcherResult { | ||
pass: boolean; | ||
message?: string; | ||
} | ||
export interface ICustomMatcher { | ||
compare<T>(actual: T, expected: T, ...args: any[]): IJasmineCustomMatcherResult; | ||
compare(actual: any, ...expected: any[]): IJasmineCustomMatcherResult; | ||
negativeCompare?<T>(actual: T, expected: T, ...args: any[]): IJasmineCustomMatcherResult; | ||
negativeCompare?(actual: any, ...expected: any[]): IJasmineCustomMatcherResult; | ||
} | ||
export {}; |
@@ -1,4 +0,2 @@ | ||
/// <reference types="jest" /> | ||
import { ICustomMatcher } from './contracts'; | ||
import type { expect as vitestExpect } from 'vitest'; | ||
import { ExpectExtend, ICustomMatcher } from './framework.contracts'; | ||
declare global { | ||
@@ -28,3 +26,3 @@ namespace jasmine { | ||
}; | ||
export declare function addMatchers(expectParam?: jest.Expect | typeof vitestExpect): void; | ||
export declare function addMatchers(expectParam?: ExpectExtend): void; | ||
declare function wasCalled(): ICustomMatcher; | ||
@@ -31,0 +29,0 @@ declare function wasCalledOnce(): ICustomMatcher; |
@@ -1,2 +0,3 @@ | ||
import { ConstructorFunction, ConstructorParams, FunctionName, FunctionParams, IFunctionVerifier, IFunctionWithParametersVerification, IJasmineCustomMatcherResult, IJestCustomMatcherResult, IMocked, IStrictFunctionVerification, LookupFunction, LookupType, ParameterMatcher, SetterTypes } from './contracts'; | ||
import { ConstructorFunction, ConstructorParams, FunctionName, FunctionParams, IFunctionVerifier, IFunctionWithParametersVerification, IMocked, IStrictFunctionVerification, LookupFunction, LookupType, ParameterMatcher, SetterTypes } from './contracts'; | ||
import { IJasmineCustomMatcherResult, IJestCustomMatcherResult } from './framework.contracts'; | ||
export type VerifierParams<T, C extends ConstructorFunction<T>, U extends LookupType, K extends FunctionName<T, C, U>> = U extends SetterTypes ? [LookupFunction<T, C, U, K>] : FunctionParams<LookupFunction<T, C, U, K>>; | ||
@@ -3,0 +4,0 @@ export declare function createConstructorParameterVerifier<T, C extends ConstructorFunction<T>>(mocked: IMocked<T, C>): IFunctionWithParametersVerification<ConstructorParams<C>, T, 'constructorFunction', C>; |
@@ -323,24 +323,1 @@ export type OperatorFunction<T, C extends ConstructorFunction<T>> = (value: IMocked<T, C>) => IMocked<T, C>; | ||
} | ||
/** | ||
* Copied here from Jest types to avoid the need for consuming projects to install Jest types | ||
*/ | ||
export interface IJestCustomMatcherResult { | ||
pass: boolean; | ||
message: () => string; | ||
} | ||
/** | ||
* Copied here from Jasmine types to avoid the need for consuming projects to install Jasmine types | ||
*/ | ||
export interface IJasmineCustomMatcherResult { | ||
pass: boolean; | ||
message?: string; | ||
} | ||
export interface ICustomMatcher { | ||
compare<T>(actual: T, expected: T, ...args: any[]): IJasmineCustomMatcherResult; | ||
compare(actual: any, ...expected: any[]): IJasmineCustomMatcherResult; | ||
negativeCompare?<T>(actual: T, expected: T, ...args: any[]): IJasmineCustomMatcherResult; | ||
negativeCompare?(actual: any, ...expected: any[]): IJasmineCustomMatcherResult; | ||
} |
/* eslint-disable @typescript-eslint/no-namespace */ | ||
import { ICustomMatcher, IFunctionVerifier } from './contracts'; | ||
import { IFunctionVerifier } from './contracts'; | ||
import { verifyFunctionCalled } from './verifiers'; | ||
import type { expect as vitestExpect } from 'vitest'; | ||
import { ExpectExtend, ICustomMatcher } from './framework.contracts'; | ||
@@ -35,3 +35,3 @@ declare global { | ||
/* istanbul ignore next */ | ||
export function addMatchers(expectParam?: jest.Expect | typeof vitestExpect) { | ||
export function addMatchers(expectParam?: ExpectExtend) { | ||
// jasmine.addMatchers must be called in a before function so this will sometimes throw an error | ||
@@ -45,3 +45,3 @@ try { | ||
try { | ||
((expectParam ?? expect) as unknown as jest.Expect).extend({ | ||
((expectParam ?? expect) as ExpectExtend).extend({ | ||
wasCalled: mapToCustomMatcher(wasCalled()), | ||
@@ -48,0 +48,0 @@ wasCalledOnce: mapToCustomMatcher(wasCalledOnce()), |
@@ -9,4 +9,2 @@ import { getLookup, runningInJest } from '../helper'; | ||
IFunctionWithParametersVerification, | ||
IJasmineCustomMatcherResult, | ||
IJestCustomMatcherResult, | ||
IMocked, | ||
@@ -22,2 +20,3 @@ IParameterMatcher, | ||
} from './contracts'; | ||
import { IJasmineCustomMatcherResult, IJestCustomMatcherResult } from './framework.contracts'; | ||
import { isParameterMatcher, mapItemToString, toBe, toEqual } from './parameterMatchers'; | ||
@@ -24,0 +23,0 @@ |
{ | ||
"name": "@morgan-stanley/ts-mocking-bird", | ||
"version": "1.3.0", | ||
"version": "1.3.1", | ||
"description": "A fully type safe mocking, call verification and import replacement library for jasmine and jest", | ||
@@ -17,2 +17,3 @@ "license": "Apache-2.0", | ||
"build-release": "npm run verify-release", | ||
"postbuild-release": "typedoc main/index.ts", | ||
"watch-build": "tsc --watch -p main/tsconfig.json", | ||
@@ -97,2 +98,3 @@ "test": "npm run test:karma", | ||
"lodash": "^4.17.16", | ||
"typedoc": "^0.27.6", | ||
"uuid": "^7.0.3" | ||
@@ -99,0 +101,0 @@ }, |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
197434
61
3213
6
+ Addedtypedoc@^0.27.6
+ Added@babel/compat-data@7.26.8(transitive)
+ Added@babel/core@7.26.8(transitive)
+ Added@babel/generator@7.26.8(transitive)
+ Added@babel/parser@7.26.8(transitive)
+ Added@babel/template@7.26.8(transitive)
+ Added@babel/traverse@7.26.8(transitive)
+ Added@babel/types@7.26.8(transitive)
+ Added@gerrit0/mini-shiki@1.27.2(transitive)
+ Added@shikijs/engine-oniguruma@1.29.2(transitive)
+ Added@shikijs/types@1.29.2(transitive)
+ Added@shikijs/vscode-textmate@10.0.1(transitive)
+ Added@types/gensync@1.0.4(transitive)
+ Added@types/hast@3.0.4(transitive)
+ Added@types/unist@3.0.3(transitive)
+ Addedargparse@2.0.1(transitive)
+ Addedcaniuse-lite@1.0.30001699(transitive)
+ Addedelectron-to-chromium@1.5.97(transitive)
+ Addedentities@4.5.0(transitive)
+ Addedjasmine@5.6.0(transitive)
+ Addedjasmine-core@5.6.0(transitive)
+ Addedlinkify-it@5.0.0(transitive)
+ Addedlunr@2.3.9(transitive)
+ Addedmarkdown-it@14.1.0(transitive)
+ Addedmdurl@2.0.0(transitive)
+ Addedpunycode.js@2.3.1(transitive)
+ Addedtypedoc@0.27.7(transitive)
+ Addeduc.micro@2.1.0(transitive)
+ Addedyaml@2.7.0(transitive)
- Removed@babel/compat-data@7.26.5(transitive)
- Removed@babel/core@7.26.7(transitive)
- Removed@babel/generator@7.26.5(transitive)
- Removed@babel/parser@7.26.7(transitive)
- Removed@babel/template@7.25.9(transitive)
- Removed@babel/traverse@7.26.7(transitive)
- Removed@babel/types@7.26.7(transitive)
- Removedcaniuse-lite@1.0.30001698(transitive)
- Removedelectron-to-chromium@1.5.96(transitive)
- Removedjasmine@5.5.0(transitive)
- Removedjasmine-core@5.5.0(transitive)