@vitest/utils 1.0.0-beta.2 → 1.0.0-beta.4
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/error.js +1 -1
- package/dist/helpers.js +2 -2
- package/dist/source-map.d.ts +1 -0
- package/dist/source-map.js +3 -1
- package/package.json +2 -2
package/dist/error.js
CHANGED
@@ -83,7 +83,7 @@ function processError(err, diffOptions) {
|
|
83
83
|
const clonedActual = deepClone(err.actual, { forceWritable: true });
|
84
84
|
const clonedExpected = deepClone(err.expected, { forceWritable: true });
|
85
85
|
const { replacedActual, replacedExpected } = replaceAsymmetricMatcher(clonedActual, clonedExpected);
|
86
|
-
err.diff = diff(replacedExpected, replacedActual, diffOptions);
|
86
|
+
err.diff = diff(replacedExpected, replacedActual, { ...diffOptions, ...err.diffOptions });
|
87
87
|
}
|
88
88
|
if (typeof err.expected !== "string")
|
89
89
|
err.expected = stringify(err.expected, 10);
|
package/dist/helpers.js
CHANGED
@@ -62,7 +62,7 @@ function clone(val, seen, options = defaultCloneOptions) {
|
|
62
62
|
out = Array(k = val.length);
|
63
63
|
seen.set(val, out);
|
64
64
|
while (k--)
|
65
|
-
out[k] = clone(val[k], seen);
|
65
|
+
out[k] = clone(val[k], seen, options);
|
66
66
|
return out;
|
67
67
|
}
|
68
68
|
if (Object.prototype.toString.call(val) === "[object Object]") {
|
@@ -73,7 +73,7 @@ function clone(val, seen, options = defaultCloneOptions) {
|
|
73
73
|
const descriptor = Object.getOwnPropertyDescriptor(val, k2);
|
74
74
|
if (!descriptor)
|
75
75
|
continue;
|
76
|
-
const cloned = clone(val[k2], seen);
|
76
|
+
const cloned = clone(val[k2], seen, options);
|
77
77
|
if ("get" in descriptor) {
|
78
78
|
Object.defineProperty(out, k2, {
|
79
79
|
...descriptor,
|
package/dist/source-map.d.ts
CHANGED
@@ -100,6 +100,7 @@ declare class TraceMap implements SourceMap {
|
|
100
100
|
interface StackTraceParserOptions {
|
101
101
|
ignoreStackEntries?: (RegExp | string)[];
|
102
102
|
getSourceMap?: (file: string) => unknown;
|
103
|
+
frameFilter?: (error: Error, frame: ParsedStack) => boolean | void;
|
103
104
|
}
|
104
105
|
declare function parseSingleFFOrSafariStack(raw: string): ParsedStack | null;
|
105
106
|
declare function parseSingleStack(raw: string): ParsedStack | null;
|
package/dist/source-map.js
CHANGED
@@ -868,7 +868,9 @@ function parseErrorStacktrace(e, options = {}) {
|
|
868
868
|
if (e.stacks)
|
869
869
|
return e.stacks;
|
870
870
|
const stackStr = e.stack || e.stackStr || "";
|
871
|
-
|
871
|
+
let stackFrames = parseStacktrace(stackStr, options);
|
872
|
+
if (options.frameFilter)
|
873
|
+
stackFrames = stackFrames.filter((f) => options.frameFilter(e, f) !== false);
|
872
874
|
e.stacks = stackFrames;
|
873
875
|
return stackFrames;
|
874
876
|
}
|
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "@vitest/utils",
|
3
3
|
"type": "module",
|
4
|
-
"version": "1.0.0-beta.
|
4
|
+
"version": "1.0.0-beta.4",
|
5
5
|
"description": "Shared Vitest utility functions",
|
6
6
|
"license": "MIT",
|
7
7
|
"funding": "https://opencollective.com/vitest",
|
@@ -47,7 +47,7 @@
|
|
47
47
|
],
|
48
48
|
"dependencies": {
|
49
49
|
"diff-sequences": "^29.4.3",
|
50
|
-
"loupe": "^2.3.
|
50
|
+
"loupe": "^2.3.7",
|
51
51
|
"pretty-format": "^29.5.0"
|
52
52
|
},
|
53
53
|
"devDependencies": {
|