@vitest/expect 3.1.0-beta.2 → 3.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +4 -1
- package/dist/index.js +8 -1
- package/package.json +4 -4
package/dist/index.d.ts
CHANGED
@@ -23,7 +23,9 @@ declare function getMatcherUtils(): {
|
|
23
23
|
printReceived: typeof printReceived
|
24
24
|
printExpected: typeof printExpected
|
25
25
|
printDiffOrStringify: typeof printDiffOrStringify
|
26
|
+
printWithType: typeof printWithType
|
26
27
|
};
|
28
|
+
declare function printWithType<T>(name: string, value: T, print: (value: T) => string): string;
|
27
29
|
declare function addCustomEqualityTesters(newTesters: Array<Tester>): void;
|
28
30
|
|
29
31
|
/**
|
@@ -758,4 +760,5 @@ declare function getObjectSubset(object: any, subset: any, customTesters: Array<
|
|
758
760
|
declare function getState<State extends MatcherState = MatcherState>(expect: ExpectStatic): State;
|
759
761
|
declare function setState<State extends MatcherState = MatcherState>(state: Partial<State>, expect: ExpectStatic): void;
|
760
762
|
|
761
|
-
export { ASYMMETRIC_MATCHERS_OBJECT, Any, Anything, ArrayContaining,
|
763
|
+
export { ASYMMETRIC_MATCHERS_OBJECT, Any, Anything, ArrayContaining, AsymmetricMatcher, GLOBAL_EXPECT, JEST_MATCHERS_OBJECT, JestAsymmetricMatchers, JestChaiExpect, JestExtend, MATCHERS_OBJECT, ObjectContaining, StringContaining, StringMatching, addCustomEqualityTesters, arrayBufferEquality, customMatchers, equals, fnNameFor, generateToBeMessage, getObjectKeys, getObjectSubset, getState, hasAsymmetric, hasProperty, isA, isAsymmetric, isImmutableUnorderedKeyed, isImmutableUnorderedSet, iterableEquality, pluralize, setState, sparseArrayEquality, subsetEquality, typeEquality };
|
764
|
+
export type { Assertion, AsymmetricMatcherInterface, AsymmetricMatchersContaining, AsyncExpectationResult, ChaiPlugin, ExpectStatic, ExpectationResult, JestAssertion, MatcherHintOptions, MatcherState, MatchersObject, PromisifyAssertion, RawMatcherFn, SyncExpectationResult, Tester, TesterContext };
|
package/dist/index.js
CHANGED
@@ -124,9 +124,16 @@ function getMatcherUtils() {
|
|
124
124
|
matcherHint,
|
125
125
|
printReceived,
|
126
126
|
printExpected,
|
127
|
-
printDiffOrStringify
|
127
|
+
printDiffOrStringify,
|
128
|
+
printWithType
|
128
129
|
};
|
129
130
|
}
|
131
|
+
function printWithType(name, value, print) {
|
132
|
+
const type = getType(value);
|
133
|
+
const hasType = type !== "null" && type !== "undefined" ? `${name} has type: ${type}\n` : "";
|
134
|
+
const hasValue = `${name} has value: ${print(value)}`;
|
135
|
+
return hasType + hasValue;
|
136
|
+
}
|
130
137
|
function addCustomEqualityTesters(newTesters) {
|
131
138
|
if (!Array.isArray(newTesters)) {
|
132
139
|
throw new TypeError(`expect.customEqualityTesters: Must be set to an array of Testers. Was given "${getType(newTesters)}"`);
|
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "@vitest/expect",
|
3
3
|
"type": "module",
|
4
|
-
"version": "3.1.0
|
4
|
+
"version": "3.1.0",
|
5
5
|
"description": "Jest's expect matchers as a Chai plugin",
|
6
6
|
"license": "MIT",
|
7
7
|
"funding": "https://opencollective.com/vitest",
|
@@ -32,13 +32,13 @@
|
|
32
32
|
"dependencies": {
|
33
33
|
"chai": "^5.2.0",
|
34
34
|
"tinyrainbow": "^2.0.0",
|
35
|
-
"@vitest/spy": "3.1.0
|
36
|
-
"@vitest/utils": "3.1.0
|
35
|
+
"@vitest/spy": "3.1.0",
|
36
|
+
"@vitest/utils": "3.1.0"
|
37
37
|
},
|
38
38
|
"devDependencies": {
|
39
39
|
"@types/chai": "5.0.1",
|
40
40
|
"rollup-plugin-copy": "^3.5.0",
|
41
|
-
"@vitest/runner": "3.1.0
|
41
|
+
"@vitest/runner": "3.1.0"
|
42
42
|
},
|
43
43
|
"scripts": {
|
44
44
|
"build": "rimraf dist && rollup -c",
|