@vitest/utils
Advanced tools
Comparing version 0.30.0 to 0.30.1
@@ -119,13 +119,13 @@ import { notNullish, isPrimitive } from './helpers.js'; | ||
} | ||
function loupeInspect(obj) { | ||
function loupeInspect(obj, options = {}) { | ||
return loupe(obj, { | ||
depth: 2, | ||
truncate: 40 | ||
truncate: options.truncateThreshold === 0 ? Infinity : options.truncateThreshold ?? 40 | ||
}); | ||
} | ||
function objDisplay(obj) { | ||
const truncateThreshold = 40; | ||
const str = loupeInspect(obj); | ||
function objDisplay(obj, options = {}) { | ||
const truncateThreshold = options.truncateThreshold ?? 40; | ||
const str = loupeInspect(obj, options); | ||
const type = Object.prototype.toString.call(obj); | ||
if (str.length >= truncateThreshold) { | ||
if (truncateThreshold && str.length >= truncateThreshold) { | ||
if (type === "[object Function]") { | ||
@@ -132,0 +132,0 @@ const fn = obj; |
@@ -1,172 +0,1 @@ | ||
import { DisplayOptions } from 'concordance'; | ||
declare function getConcordanceTheme(): { | ||
boolean: { | ||
(input: unknown): string; | ||
open: string; | ||
close: string; | ||
}; | ||
circular: string; | ||
date: { | ||
invalid: string; | ||
value: { | ||
(input: unknown): string; | ||
open: string; | ||
close: string; | ||
}; | ||
}; | ||
diffGutters: { | ||
actual: string; | ||
expected: string; | ||
padding: string; | ||
}; | ||
error: { | ||
ctor: { | ||
open: string; | ||
close: string; | ||
}; | ||
name: { | ||
(input: unknown): string; | ||
open: string; | ||
close: string; | ||
}; | ||
}; | ||
function: { | ||
name: { | ||
(input: unknown): string; | ||
open: string; | ||
close: string; | ||
}; | ||
stringTag: { | ||
(input: unknown): string; | ||
open: string; | ||
close: string; | ||
}; | ||
}; | ||
global: { | ||
(input: unknown): string; | ||
open: string; | ||
close: string; | ||
}; | ||
item: { | ||
after: string; | ||
}; | ||
list: { | ||
openBracket: string; | ||
closeBracket: string; | ||
}; | ||
mapEntry: { | ||
after: string; | ||
}; | ||
maxDepth: string; | ||
null: { | ||
(input: unknown): string; | ||
open: string; | ||
close: string; | ||
}; | ||
number: { | ||
(input: unknown): string; | ||
open: string; | ||
close: string; | ||
}; | ||
object: { | ||
openBracket: string; | ||
closeBracket: string; | ||
ctor: { | ||
(input: unknown): string; | ||
open: string; | ||
close: string; | ||
}; | ||
stringTag: { | ||
open: string; | ||
close: string; | ||
}; | ||
secondaryStringTag: { | ||
open: string; | ||
close: string; | ||
}; | ||
}; | ||
property: { | ||
after: string; | ||
keyBracket: { | ||
open: string; | ||
close: string; | ||
}; | ||
valueFallback: string; | ||
}; | ||
regexp: { | ||
source: { | ||
open: string; | ||
close: string; | ||
}; | ||
flags: { | ||
(input: unknown): string; | ||
open: string; | ||
close: string; | ||
}; | ||
}; | ||
stats: { | ||
separator: string; | ||
}; | ||
string: { | ||
open: string; | ||
close: string; | ||
line: { | ||
open: string; | ||
close: string; | ||
}; | ||
multiline: { | ||
start: string; | ||
end: string; | ||
}; | ||
controlPicture: { | ||
(input: unknown): string; | ||
open: string; | ||
close: string; | ||
}; | ||
diff: { | ||
insert: { | ||
open: string; | ||
close: string; | ||
}; | ||
delete: { | ||
open: string; | ||
close: string; | ||
}; | ||
equal: { | ||
(input: unknown): string; | ||
open: string; | ||
close: string; | ||
}; | ||
insertLine: { | ||
open: string; | ||
close: string; | ||
}; | ||
deleteLine: { | ||
open: string; | ||
close: string; | ||
}; | ||
}; | ||
}; | ||
symbol: { | ||
(input: unknown): string; | ||
open: string; | ||
close: string; | ||
}; | ||
typedArray: { | ||
bytes: { | ||
(input: unknown): string; | ||
open: string; | ||
close: string; | ||
}; | ||
}; | ||
undefined: { | ||
(input: unknown): string; | ||
open: string; | ||
close: string; | ||
}; | ||
}; | ||
declare function diffDescriptors(actual: unknown, expected: unknown, options: DisplayOptions): string; | ||
declare function formatDescriptor(value: unknown, options: DisplayOptions): string; | ||
interface DiffOptions { | ||
@@ -185,2 +14,2 @@ showLegend?: boolean; | ||
export { DiffOptions, diffDescriptors, formatDescriptor, getConcordanceTheme, unifiedDiff }; | ||
export { DiffOptions, unifiedDiff }; |
@@ -86,5 +86,2 @@ import { b as getColors } from './chunk-colors.js'; | ||
} | ||
function formatDescriptor(value, options) { | ||
return concordance.formatDescriptor(value, options); | ||
} | ||
@@ -119,2 +116,2 @@ function unifiedDiff(actual, expected, options = {}) { | ||
export { diffDescriptors, formatDescriptor, getConcordanceTheme, unifiedDiff }; | ||
export { unifiedDiff }; |
@@ -24,6 +24,9 @@ export { assertTypes, clone, createDefer, deepClone, getCallLastIndex, getOwnProperties, getType, isObject, isPrimitive, noop, notNullish, objectAttr, parseRegexp, slash, toArray } from './helpers.js'; | ||
interface LoupeOptions { | ||
truncateThreshold?: number; | ||
} | ||
declare function format(...args: any[]): string; | ||
declare function utilInspect(item: unknown, options?: util.InspectOptions): string; | ||
declare function loupeInspect(obj: unknown): string; | ||
declare function objDisplay(obj: unknown): string; | ||
declare function loupeInspect(obj: unknown, options?: LoupeOptions): string; | ||
declare function objDisplay(obj: unknown, options?: LoupeOptions): string; | ||
@@ -30,0 +33,0 @@ declare const SAFE_TIMERS_SYMBOL: unique symbol; |
@@ -119,13 +119,13 @@ import { notNullish, isPrimitive } from './helpers.js'; | ||
} | ||
function loupeInspect(obj) { | ||
function loupeInspect(obj, options = {}) { | ||
return loupe(obj, { | ||
depth: 2, | ||
truncate: 40 | ||
truncate: options.truncateThreshold === 0 ? Infinity : options.truncateThreshold ?? 40 | ||
}); | ||
} | ||
function objDisplay(obj) { | ||
const truncateThreshold = 40; | ||
const str = loupeInspect(obj); | ||
function objDisplay(obj, options = {}) { | ||
const truncateThreshold = options.truncateThreshold ?? 40; | ||
const str = loupeInspect(obj, options); | ||
const type = Object.prototype.toString.call(obj); | ||
if (str.length >= truncateThreshold) { | ||
if (truncateThreshold && str.length >= truncateThreshold) { | ||
if (type === "[object Function]") { | ||
@@ -132,0 +132,0 @@ const fn = obj; |
{ | ||
"name": "@vitest/utils", | ||
"type": "module", | ||
"version": "0.30.0", | ||
"version": "0.30.1", | ||
"description": "Shared Vitest utility functions", | ||
@@ -32,3 +32,4 @@ "license": "MIT", | ||
"files": [ | ||
"dist" | ||
"dist", | ||
"*.d.ts" | ||
], | ||
@@ -35,0 +36,0 @@ "dependencies": { |
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
14
0
41658
1182