Private
consoleThe original Console
object, preserved to avoid overwriting
Vitest's native console.log
wrapping.
Private
Static
Readonly
queuedA list of warnings that are queued to be displayed after all tests in the same file are finished.
The console.assert()
static method writes an error message to the console if the assertion is false.
Private
checkCheck whether a given set of data is in the blacklist to be barred from logging.
The data being logged
Whether data
is blacklisted from console logging
The console.clear()
static method clears the console if possible.
The console.count()
static method logs the number of times that this particular call to count()
has been called.
The console.countReset()
static method resets counter used with console/count_static.
The console.debug()
static method outputs a message to the console at the 'debug' log level.
The console.dir()
static method displays a list of the properties of the specified JavaScript object.
The console.dirxml()
static method displays an interactive tree of the descendant elements of the specified XML/HTML element.
The console.error()
static method outputs a message to the console at the 'error' log level.
Private
formatStringify the given data in a manner fit for logging.
A Chalk instance or other transformation function used to transform the output,
or undefined
to not transform it at all.
The data that the format should be applied to.
A stringified copy of data
with color
applied to each individual argument.
Private
getReturns a human-readable string representation of data
.
The console.group()
static method creates a new inline group in the Web console log, causing any subsequent console messages to be indented by an additional level, until console/groupEnd_static is called.
The console.groupCollapsed()
static method creates a new inline group in the console.
The console.groupEnd()
static method exits the current inline group in the console.
The console.info()
static method outputs a message to the console at the 'info' log level.
The console.log()
static method outputs a message to the console.
This method does not display anything unless used in the inspector. The console.profile()
method starts a JavaScript CPU profile with an optional label until profileEnd
is called. The profile is then added to the Profile panel of the inspector.
console.profile('MyLabel');
// Some code
console.profileEnd('MyLabel');
// Adds the profile 'MyLabel' to the Profiles panel of the inspector.
This method does not display anything unless used in the inspector. Stops the current JavaScript CPU profiling session if one has been started and prints the report to the Profiles panel of the inspector. See profile for an example.
If this method is called without a label, the most recently started profile is stopped.
The console.table()
static method displays tabular data as a table.
The console.time()
static method starts a timer you can use to track how long an operation takes.
The console.timeEnd()
static method stops a timer that was previously started by calling console/time_static.
The console.timeLog()
static method logs the current value of a timer that was previously started by calling console/time_static.
The console.trace()
static method outputs a stack trace to the console.
The console.warn()
static method outputs a warning message to the console at the 'warning' log level.
Static
printPrint and reset all post-test warnings.
Static
queueQueue a warning to be printed after all tests in the same file are finished.
The
MockConsole
is a wrapper around the globalconsole
object. It automatically colors text and such.