Return a stringified version of the value with indentation and colors where applicable

inspect(value: Any, opts: [Object]): string
Parameters
value (Any) The value to inspect
opts ([Object] (default {}) ) The options to pass to util.inspect
Returns
string: The inspected string of the value

Return a highlighted comparison between the new data and the old data

diffstrings(newData: Object, oldData: Object): string
Parameters
newData (Object) The new data
oldData (Object) The old data
Returns
string: The highlighted comparison

Return a highlighted comparison between the new data and the old data

diffObjects(newData: Object, oldData: Object): string
Parameters
newData (Object) The new data
oldData (Object) The old data
Returns
string: The highlighted comparison

Log the inspected values of each of the arguments to stdout

log(args: ...Any): void
Parameters
args (...Any) The arguments to inspect and log
Returns
void:

Same as assert.equal in that it performs a strict equals check, but if a failure occurs it will output detailed information

equal(actual: Any, expected: Any, testName: [string]): void
Parameters
actual (Any) The result data
expected (Any) The anticipated data
testName ([string] (default 'equal comparison') ) The name of the test
Returns
void:
Throws
  • Error: If the comparison failed, the failure will be thrown

Same as assert.deepEQual in that it performs a deep equals check, but if a failure occurs it will output detailed information

deepEqual(actual: Any, expected: Any, testName: [string]): void
Parameters
actual (Any) The result data
expected (Any) The anticipated data
testName ([string] (default 'deep equal assertion') ) The name of the test
Returns
void:
Throws
  • Error: If the comparison failed, the failure will be thrown

Checks to see if the actual result contains the expected result

contains(actual: Any, expected: Any, testName: [string]): void
Parameters
actual (Any) The result data
expected (Any) The anticipated data
testName ([string] (default 'contains assertion') ) The name of the test
Returns
void:
Throws
  • Error: If the comparison failed, the failure will be thrown

Checks to see if an error was as expected, if a failure occurs it will output detailed information

errorEqual(actualError: Error, expectedError: (Error | string | null), testName: [string]): void
Parameters
actualError (Error) The result error
expectedError ((Error | string | null)) The anticipated error instance or message, can be null if you expect there to be no error
testName ([string] (default 'error equal assertion') ) The name of the test
Returns
void:
Throws
  • Error: If the comparison failed, the failure will be thrown

returnViaCallback

./source/index.js

Generate a callback that will return the specified result

returnViaCallback(result: Any): Function
Parameters
result (Any) The result that the callback should return
Returns
Function: The callback that will return the specified result

completeViaCallback

./source/index.js

Generate a callback that will receive a completion callback and call it with the specified result after the specified delay

completeViaCallback(result: Any, delay: [Number]): Function
Parameters
result (Any) The result that the callback should pass to the completion callback
delay ([Number] (default 100) ) The delay in milliseconds that we should wait before calling the completion callback
Returns
Function: The callback that will provide the specified result

returnErrorViaCallback

./source/index.js

Generate a callback that return an error instance with the specified message/error

returnErrorViaCallback(error: [(Error | string)]): Function
Parameters
error ([(Error | string)] (default 'an error occured') ) The error instance or message string that the callback will return
Returns
Function: The callback that will return the specified result

throwErrorViaCallback

./source/index.js

Generate a callback that throw an error instance with the specified message/error

throwErrorViaCallback(error: [(Error | string)]): Function
Parameters
error ([(Error | string)] (default 'an error occured') ) The error instance or message string that the callback will throw
Returns
Function: The callback that will throw the specified error

expectViaCallback

./source/index.js

Generate a callback that will check the arguments it received with the arguments specified, if a failure occurs it will output detailed information

expectViaCallback(argsExpected: ...Any): Function
Parameters
argsExpected (...Any) The arguments that we expect the callback to receive when it is called
Returns
Function: The callback that will check the arguments it receives for the expected arguments

expectErrorViaCallback

./source/index.js

Generate a callback that will check the error (if any) it receives for the expected error (if any), if a failure occurs it will output detailed information

expectErrorViaCallback(error: Any, testName: [string], next: [Function]): Function
Parameters
error (Any) The error instance or message string that we expected, passed as the second argument to errorEqual
testName ([string] (default 'expect error via callback assertion') ) The name of the test
next ([Function]) An optional completion callback to call with the result of the compairson, if not specified and a failure occurs, the error will be thrown
Returns
Function: The callback that will check the error (if any) it receives for the expected error (if any)

expectFunctionToThrow

./source/index.js

Expect the passed function to throw the passed error (if any)

expectFunctionToThrow(fn: Function, error: (Error | string), testName: [string]): void
Parameters
fn (Function) The function that we will call and expect to throw the passed error
error ((Error | string)) The error instance or message string that we expected, passed as the second argument to errorEqual
testName ([string] (default 'expect function to throw') ) The name of the test
Returns
void:

expectErrorViaFunction

./source/index.js

Expect the passed function to throw an error at some point

expectErrorViaFunction(error: Any, fn: Function, testName: [string], next: [Function]): void
Parameters
error (Any) The error instance or message string that we expected, passed as the second argument to errorEqual
fn (Function) The function that we will call and expect to throw or emit the passed error
testName ([string] (default 'expect error via function assertion') ) The name of the test
next ([Function]) An optional completion callback to call with the result of the compairson, if not specified and a failure occurs, the error will be thrown
Returns
void: