New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@morgan-stanley/ts-mocking-bird

Package Overview
Dependencies
Maintainers
3
Versions
41
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@morgan-stanley/ts-mocking-bird - npm Package Compare versions

Comparing version 1.3.0 to 1.3.1

dist/main/mock/framework.contracts.d.ts

20

dist/main/mock/contracts.d.ts

@@ -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 {};

6

dist/main/mock/matchers.d.ts

@@ -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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc