Assert module is for writing test for applications.
Assert module will produce AssertionError
in case of assertion failure. AssertionError
inherits standard Error
thus it has properties provided by Error
object including additional properties.
The name of AssertionError
is 'AssertionError` this is fixed.
This property contains the actual value.
This property contains the expected value.
This property contains the operator used for evaluating actual
with expected
.
The error message.
You can get assert module by require('assert')
the module provide.
Throw an AssertionError
exception.
Test if value
is true, it throws an AssertionError
exception if value
evaluates false
.
Test if actual == expected
is evaluated to true
, if not, it throws an exception.
Test if actual != expected
is evaluated to true
, if not, it throws an exception.
Test if actual === expected
is evaluated to true
, if not, it throws an exception.
Test if actual !== expected
is evaluated to true
, if not, it throws an exception.
Test if the given block
throws an expected
error, if not, it throws an exception.
Test if the given block
does not throw any exception, if not, it throws an exception.