Tap
Render TAP-formatted output.
Methods
Static
Styles
Object —Available styles. See Customization.
-
messageToString(val, indent)
function —This function is used to get the string value of messages passed to
renderDiagnostic
.
Properties
new Tap(style, debug, EOL)
Creates a new Tap
object and sets the this.style
, this.debug
, and this.EOL
properties.
-
style
Object —define style prefixes for output elements
(default:Tap.Styles.None
) -
debug
bool —include stack trace in error output if
(default:true
false
) -
EOL
string —line ending used when rendering output
(default:'\n'
)
Examples
renderPlan(count)
Render and return a TAP plan string.
-
count
number —the number of tests to be run
Examples
renderResult(ok, idx, name, suffix)
Render and return a TAP result string.
-
ok
bool —true
if the test passed, otherwisefalse
-
idx
number —test number (determined by order finished)
-
name
string —test name
-
suffix
string —will be prefixed with
this.EOL
and added to the end of the result string
Examples
renderDiagnostic(message, prefix)
Render and return a TAP diagnostic string.
-
message
any —message to display
-
prefix
string —prefix will be added to each line in rendered message
(default:'# '
)
Examples
handleStart(info)
Render and return a TAP plan string.
-
info
RunStartInfo
Examples
handleEnd(info)
Render and return a TAP diagnostic message containing a footer with final result counts.
-
info
RunEndInfo
Examples
handleResult(info)
Render and return a TAP result message that includes any error and/or diagnostic message provided.
-
info
TestResultInfo
Examples
prefixLines(text, prefix)
Add a prefix to every line of a string.
Examples
Output
# ! Test message
# ! Second line
# ! Third line
setStyle(style)
Set the this.style
property. Changes the style used when rendering output.
-
style
TapStyle
setDebug(isEnabled)
Set the this.debug
property. Causes Error stack to be included in output if true
.
-
isEnabled
bool
setEOL(eol)
Set the this.EOL
property. Changes the line ending character used when rendering output.
-
eol
string
Tap.messageToString(val, indent)
This function is used to get the string value of messages passed to renderDiagnostic
.
-
val
any —value to be stringified (maybe)
-
indent
number —number of spaces used to indent the JSON object
(default:2
)
See
-
maybeStringify
—
used by this function to produce the string
-
this.renderDiagnostic
—
uses this function to get the string value of
message