API Reference / @gtkx/testing / prettyFormat / Options
Interface: Options
Extends
Omit<RequiredOptions,"compareKeys"|"theme">
Properties
callToJSON
callToJSON:
boolean
Call toJSON on objects before formatting them. Ignored after the formatter has already called toJSON once for a value.
Default
trueInherited from
PrettyFormatOptions.callToJSON
compareKeys
compareKeys:
CompareKeys
escapeRegex
escapeRegex:
boolean
Whether to escape special characters in regular expressions.
Default
falseInherited from
PrettyFormatOptions.escapeRegex
escapeString
escapeString:
boolean
Whether to escape special characters in strings.
Default
trueInherited from
PrettyFormatOptions.escapeString
highlight
highlight:
boolean
Whether to highlight syntax using terminal colors.
Default
falseInherited from
indent
indent:
number
Number of spaces to use for each level of indentation.
Default
2Inherited from
maxDepth
maxDepth:
number
Maximum depth to recurse into nested values.
Default
InfinityInherited from
maxOutputLength
maxOutputLength:
number
Approximate per-depth-level budget for output length. When the accumulated output at any single depth level exceeds this value, further nesting is collapsed. This is a heuristic safety valve, not a hard limit — total output can reach up to roughly maxDepth × maxOutputLength.
Default
1_000_000Inherited from
PrettyFormatOptions.maxOutputLength
maxWidth
maxWidth:
number
Maximum number of items to print in arrays, sets, maps, and similar collections.
Default
InfinityInherited from
min
min:
boolean
Whether to minimize added whitespace, including indentation and line breaks.
When true, pretty-format defaults spacingInner to ' ', spacingOuter to '', and ignores indentation. It also changes the default for printBasicPrototype from true to false, although an explicit printBasicPrototype still wins. Explicit spacingInner / spacingOuter overrides still apply.
Default
falseInherited from
plugins
plugins:
Plugins
Plugins used to serialize application-specific data types.
Default
[]Inherited from
printBasicPrototype
printBasicPrototype:
boolean
Whether to print Object / Array prefixes for plain objects and arrays.
Defaults to true, unless min is true, in which case it defaults to false. An explicit printBasicPrototype value always overrides the min default.
Inherited from
PrettyFormatOptions.printBasicPrototype
printFunctionName
printFunctionName:
boolean
Whether to include the function name when formatting functions.
Default
trueInherited from
PrettyFormatOptions.printFunctionName
printShadowRoot
printShadowRoot:
boolean
Whether to include shadow-root contents when formatting DOM nodes.
Default
trueInherited from
PrettyFormatOptions.printShadowRoot
quoteKeys
quoteKeys:
boolean
Whether to always quote object property keys.
For example: {"a": 1} when true{a: 1} when false and the key is a valid identifier {"my-key": 1} still stays quoted because it is not a valid identifier
Default
trueInherited from
singleQuote
singleQuote:
boolean
Whether to print strings using single quotes instead of double quotes.
For example: "hello" when false'hello' when true
Default
falseInherited from
PrettyFormatOptions.singleQuote
spacingInner
spacingInner:
string
Whitespace inserted after commas between items or entries.
For example, in {a: 1, b: 2} or [1, 2], this controls the gap after each comma: {a: 1,${spacingInner}b: 2}[1,${spacingInner}2]
Defaults to '\n' in regular mode and ' ' when min is true. Can be overridden independently of min.
Inherited from
PrettyFormatOptions.spacingInner
spacingOuter
spacingOuter:
string
Whitespace inserted immediately inside collection/object delimiters.
For example, this controls the space or newline right after the opening delimiter and right before the closing delimiter: {${spacingOuter}a: 1${spacingOuter}}[${spacingOuter}1${spacingOuter}]
Defaults to '\n' in regular mode and '' when min is true. Can be overridden independently of min.
Inherited from
PrettyFormatOptions.spacingOuter
theme
theme:
Theme