@vitest/expect
Advanced tools
Comparing version 0.32.0 to 0.32.1
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": { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
104109
3016
+ Added@vitest/spy@0.32.1(transitive)
+ Added@vitest/utils@0.32.1(transitive)
+ Addeddiff-sequences@29.6.3(transitive)
- Removed@vitest/spy@0.32.0(transitive)
- Removed@vitest/utils@0.32.0(transitive)
- Removedblueimp-md5@2.19.0(transitive)
- Removedconcordance@5.0.4(transitive)
- Removeddate-time@3.1.0(transitive)
- Removedesutils@2.0.3(transitive)
- Removedfast-diff@1.3.0(transitive)
- Removedjs-string-escape@1.0.1(transitive)
- Removedlodash@4.17.21(transitive)
- Removedmd5-hex@3.0.1(transitive)
- Removedsemver@7.6.3(transitive)
- Removedtime-zone@1.0.0(transitive)
- Removedwell-known-symbols@2.0.0(transitive)
Updated@vitest/spy@0.32.1
Updated@vitest/utils@0.32.1