Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@vitest/expect

Package Overview
Dependencies
Maintainers
3
Versions
98
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@vitest/expect - npm Package Compare versions

Comparing version 0.32.0 to 0.32.1

56

./dist/index.js
import { getColors, stringify, isObject, assertTypes } from '@vitest/utils';
export { setupColors } from '@vitest/utils';
import { unifiedDiff } from '@vitest/utils/diff';
import { diff } from '@vitest/utils/diff';
import { AssertionError, util } from 'chai';

@@ -104,7 +104,2 @@ import { isMockFunction } from '@vitest/spy';

}
function diff(a, b, options) {
return unifiedDiff(b, a, {
showLegend: options == null ? void 0 : options.showLegend
});
}

@@ -813,3 +808,4 @@ function equals(a, b, customTesters, strictCheck) {

"expected #{this} to not be truthy",
obj
obj,
false
);

@@ -823,3 +819,4 @@ });

"expected #{this} to not be falsy",
obj
obj,
false
);

@@ -836,3 +833,4 @@ });

actual,
expected
expected,
false
);

@@ -849,3 +847,4 @@ });

actual,
expected
expected,
false
);

@@ -862,3 +861,4 @@ });

actual,
expected
expected,
false
);

@@ -875,3 +875,4 @@ });

actual,
expected
expected,
false
);

@@ -952,3 +953,4 @@ });

received,
expected
expected,
false
);

@@ -980,8 +982,9 @@ });

Received:
${spy.mock.calls.map((callArg, i) => {
let methodCall = c().bold(` ${ordinalOf(i + 1)} ${spy.getMockName()} call:
let methodCall = c().bold(` ${ordinalOf(i + 1)} ${spy.getMockName()} call:
`);
if (actualCall)
methodCall += diff(actualCall, callArg, { showLegend: false });
methodCall += diff(actualCall, callArg, { omitAnnotationLines: true });
else

@@ -1003,8 +1006,9 @@ methodCall += stringify(callArg).split("\n").map((line) => ` ${line}`).join("\n");

Received:
${spy.mock.results.map((callReturn, i) => {
let methodCall = c().bold(` ${ordinalOf(i + 1)} ${spy.getMockName()} call return:
let methodCall = c().bold(` ${ordinalOf(i + 1)} ${spy.getMockName()} call return:
`);
if (actualReturn)
methodCall += diff(actualReturn, callReturn.value, { showLegend: false });
methodCall += diff(actualReturn, callReturn.value, { omitAnnotationLines: true });
else

@@ -1030,3 +1034,4 @@ methodCall += stringify(callReturn).split("\n").map((line) => ` ${line}`).join("\n");

number,
callCount
callCount,
false
);

@@ -1043,3 +1048,4 @@ });

1,
callCount
callCount,
false
);

@@ -1148,3 +1154,4 @@ });

expected,
thrown
thrown,
false
);

@@ -1168,3 +1175,4 @@ }

matcher.toString(),
thrown
thrown,
false
);

@@ -1183,3 +1191,4 @@ }

calledAndNotThrew,
!calledAndNotThrew
!calledAndNotThrew,
false
);

@@ -1196,3 +1205,4 @@ });

`expected number of returns: ${times}`,
`received number of returns: ${successfulReturns}`
`received number of returns: ${successfulReturns}`,
false
);

@@ -1199,0 +1209,0 @@ });

import { use } from 'chai';
import { stringify, Constructable } from '@vitest/utils';
export { setupColors } from '@vitest/utils';
import { diff } from '@vitest/utils/diff';
export { DiffOptions } from '@vitest/utils/diff';

@@ -37,3 +39,2 @@ type Formatter = (input: string | number | null | undefined) => string;

};
declare function diff(a: any, b: any, options?: DiffOptions): string;

@@ -43,2 +44,3 @@ type FirstFunctionArgument<T> = T extends (arg: infer A) => unknown ? A : never;

type Tester = (a: any, b: any) => boolean | undefined;
interface MatcherHintOptions {

@@ -54,23 +56,2 @@ comment?: string;

}
interface DiffOptions {
aAnnotation?: string;
aColor?: Formatter;
aIndicator?: string;
bAnnotation?: string;
bColor?: Formatter;
bIndicator?: string;
changeColor?: Formatter;
changeLineTrailingSpaceColor?: Formatter;
commonColor?: Formatter;
commonIndicator?: string;
commonLineTrailingSpaceColor?: Formatter;
contextLines?: number;
emptyFirstOrLastLinePlaceholder?: string;
expand?: boolean;
includeChangeCounts?: boolean;
omitAnnotationLines?: boolean;
patchColor?: Formatter;
compareKeys?: any;
showLegend?: boolean;
}
interface MatcherState {

@@ -113,2 +94,3 @@ assertionCalls: number;

<T>(actual: T, message?: string): Assertion<T>;
unreachable(message?: string): never;
soft<T>(actual: T, message?: string): Assertion<T>;

@@ -279,2 +261,2 @@ extend(expects: MatchersObject): void;

export { Any, Anything, ArrayContaining, Assertion, AsymmetricMatcher, AsymmetricMatcherInterface, AsymmetricMatchersContaining, AsyncExpectationResult, ChaiPlugin, DiffOptions, ExpectStatic, ExpectationResult, FirstFunctionArgument, GLOBAL_EXPECT, JEST_MATCHERS_OBJECT, JestAssertion, JestAsymmetricMatchers, JestChaiExpect, JestExtend, MATCHERS_OBJECT, MatcherHintOptions, MatcherState, MatchersObject, ObjectContaining, RawMatcherFn, StringContaining, StringMatching, SyncExpectationResult, Tester, arrayBufferEquality, equals, fnNameFor, generateToBeMessage, getState, hasAsymmetric, hasProperty, isA, isAsymmetric, isImmutableUnorderedKeyed, isImmutableUnorderedSet, iterableEquality, setState, sparseArrayEquality, subsetEquality, typeEquality };
export { Any, Anything, ArrayContaining, Assertion, AsymmetricMatcher, AsymmetricMatcherInterface, AsymmetricMatchersContaining, AsyncExpectationResult, ChaiPlugin, ExpectStatic, ExpectationResult, FirstFunctionArgument, GLOBAL_EXPECT, JEST_MATCHERS_OBJECT, JestAssertion, JestAsymmetricMatchers, JestChaiExpect, JestExtend, MATCHERS_OBJECT, MatcherHintOptions, MatcherState, MatchersObject, ObjectContaining, RawMatcherFn, StringContaining, StringMatching, SyncExpectationResult, Tester, arrayBufferEquality, equals, fnNameFor, generateToBeMessage, getState, hasAsymmetric, hasProperty, isA, isAsymmetric, isImmutableUnorderedKeyed, isImmutableUnorderedSet, iterableEquality, setState, sparseArrayEquality, subsetEquality, typeEquality };
import { getColors, stringify, isObject, assertTypes } from '@vitest/utils';
export { setupColors } from '@vitest/utils';
import { unifiedDiff } from '@vitest/utils/diff';
import { diff } from '@vitest/utils/diff';
import { AssertionError, util } from 'chai';

@@ -104,7 +104,2 @@ import { isMockFunction } from '@vitest/spy';

}
function diff(a, b, options) {
return unifiedDiff(b, a, {
showLegend: options == null ? void 0 : options.showLegend
});
}

@@ -813,3 +808,4 @@ function equals(a, b, customTesters, strictCheck) {

"expected #{this} to not be truthy",
obj
obj,
false
);

@@ -823,3 +819,4 @@ });

"expected #{this} to not be falsy",
obj
obj,
false
);

@@ -836,3 +833,4 @@ });

actual,
expected
expected,
false
);

@@ -849,3 +847,4 @@ });

actual,
expected
expected,
false
);

@@ -862,3 +861,4 @@ });

actual,
expected
expected,
false
);

@@ -875,3 +875,4 @@ });

actual,
expected
expected,
false
);

@@ -952,3 +953,4 @@ });

received,
expected
expected,
false
);

@@ -980,8 +982,9 @@ });

Received:
${spy.mock.calls.map((callArg, i) => {
let methodCall = c().bold(` ${ordinalOf(i + 1)} ${spy.getMockName()} call:
let methodCall = c().bold(` ${ordinalOf(i + 1)} ${spy.getMockName()} call:
`);
if (actualCall)
methodCall += diff(actualCall, callArg, { showLegend: false });
methodCall += diff(actualCall, callArg, { omitAnnotationLines: true });
else

@@ -1003,8 +1006,9 @@ methodCall += stringify(callArg).split("\n").map((line) => ` ${line}`).join("\n");

Received:
${spy.mock.results.map((callReturn, i) => {
let methodCall = c().bold(` ${ordinalOf(i + 1)} ${spy.getMockName()} call return:
let methodCall = c().bold(` ${ordinalOf(i + 1)} ${spy.getMockName()} call return:
`);
if (actualReturn)
methodCall += diff(actualReturn, callReturn.value, { showLegend: false });
methodCall += diff(actualReturn, callReturn.value, { omitAnnotationLines: true });
else

@@ -1030,3 +1034,4 @@ methodCall += stringify(callReturn).split("\n").map((line) => ` ${line}`).join("\n");

number,
callCount
callCount,
false
);

@@ -1043,3 +1048,4 @@ });

1,
callCount
callCount,
false
);

@@ -1148,3 +1154,4 @@ });

expected,
thrown
thrown,
false
);

@@ -1168,3 +1175,4 @@ }

matcher.toString(),
thrown
thrown,
false
);

@@ -1183,3 +1191,4 @@ }

calledAndNotThrew,
!calledAndNotThrew
!calledAndNotThrew,
false
);

@@ -1196,3 +1205,4 @@ });

`expected number of returns: ${times}`,
`received number of returns: ${successfulReturns}`
`received number of returns: ${successfulReturns}`,
false
);

@@ -1199,0 +1209,0 @@ });

{
"name": "@vitest/expect",
"type": "module",
"version": "0.32.0",
"version": "0.32.1",
"description": "Jest's expect matchers as a Chai plugin",

@@ -33,8 +33,8 @@ "license": "MIT",

"chai": "^4.3.7",
"@vitest/utils": "0.32.0",
"@vitest/spy": "0.32.0"
"@vitest/spy": "0.32.1",
"@vitest/utils": "0.32.1"
},
"devDependencies": {
"picocolors": "^1.0.0",
"@vitest/runner": "0.32.0"
"@vitest/runner": "0.32.1"
},

@@ -41,0 +41,0 @@ "scripts": {

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