Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

@vitest/utils

Package Overview
Dependencies
Maintainers
5
Versions
194
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@vitest/utils - npm Package Compare versions

Comparing version
4.1.5
to
4.1.6
+20
-4
dist/diff.d.ts

@@ -0,4 +1,4 @@

import { PrettyFormatOptions } from '@vitest/pretty-format';
import { D as DiffOptions } from './types.d-BCElaP-c.js';
export { a as DiffOptionsColor, S as SerializedDiffOptions } from './types.d-BCElaP-c.js';
import '@vitest/pretty-format';

@@ -79,2 +79,16 @@ /**

/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
interface StringifiedMemory {
expected?: string;
actual?: string;
}
interface Memorize {
(pointer: "expected" | "actual", stringifiedValue: string): string;
}
/**
* @param a Expected value

@@ -85,4 +99,5 @@ * @param b Received value

*/
declare function diff(a: any, b: any, options?: DiffOptions): string | undefined;
declare function printDiffOrStringify(received: unknown, expected: unknown, options?: DiffOptions): string | undefined;
declare function diff(a: any, b: any, options?: DiffOptions, memorize?: Memorize): string | undefined;
declare function getDefaultFormatOptions(options?: DiffOptions): PrettyFormatOptions;
declare function printDiffOrStringify(received: unknown, expected: unknown, options?: DiffOptions, memory?: StringifiedMemory): string | undefined;
declare function replaceAsymmetricMatcher(actual: any, expected: any, actualReplaced?: WeakSet<WeakKey>, expectedReplaced?: WeakSet<WeakKey>): {

@@ -95,2 +110,3 @@ replacedActual: any;

export { DIFF_DELETE, DIFF_EQUAL, DIFF_INSERT, Diff, DiffOptions, diff, diffLinesRaw, diffLinesUnified, diffLinesUnified2, diffStringsRaw, diffStringsUnified, getLabelPrinter, printDiffOrStringify, replaceAsymmetricMatcher };
export { DIFF_DELETE, DIFF_EQUAL, DIFF_INSERT, Diff, DiffOptions, diff, diffLinesRaw, diffLinesUnified, diffLinesUnified2, diffStringsRaw, diffStringsUnified, getDefaultFormatOptions, getLabelPrinter, printDiffOrStringify, replaceAsymmetricMatcher };
export type { StringifiedMemory };
+14
-11

@@ -1,6 +0,6 @@

import { printDiffOrStringify } from './diff.js';
import { stringify } from './display.js';
import { format } from '@vitest/pretty-format';
import { printDiffOrStringify, getDefaultFormatOptions } from './diff.js';
import { serializeValue } from './serialize.js';
import '@vitest/pretty-format';
import 'tinyrainbow';
import './display.js';
import './helpers.js';

@@ -15,13 +15,10 @@ import './constants.js';

if (err.showDiff || err.showDiff === undefined && err.expected !== undefined && err.actual !== undefined) {
err.diff = printDiffOrStringify(err.actual, err.expected, {
const options = {
...diffOptions,
...err.diffOptions
});
};
err.diff = printDiffOrStringify(err.actual, err.expected, options, err);
err.expected = prettifyValue(err.expected, options);
err.actual = prettifyValue(err.actual, options);
}
if ("expected" in err && typeof err.expected !== "string") {
err.expected = stringify(err.expected, 10);
}
if ("actual" in err && typeof err.actual !== "string") {
err.actual = stringify(err.actual, 10);
}
// some Error implementations may not allow rewriting cause

@@ -41,3 +38,9 @@ // in most cases, the assignment will lead to "err.cause = err.cause"

}
function prettifyValue(value, options) {
if (typeof value !== "string") {
return format(value, getDefaultFormatOptions(options));
}
return value;
}
export { processError, serializeValue as serializeError };
{
"name": "@vitest/utils",
"type": "module",
"version": "4.1.5",
"version": "4.1.6",
"description": "Shared Vitest utility functions",

@@ -89,3 +89,3 @@ "license": "MIT",

"tinyrainbow": "^3.1.0",
"@vitest/pretty-format": "4.1.5"
"@vitest/pretty-format": "4.1.6"
},

@@ -92,0 +92,0 @@ "devDependencies": {

Sorry, the diff of this file is too big to display