trait Assert extends Object
The assert module provides a simple set of assertion tests that can be used to test invariants. The module is intended for internal use by Node.js, but can be used in application code via require('assert'). However, assert is not a testing framework, and is not intended to be used as a general purpose assertion library.
The API for the assert module is Locked. This means that there will be no additions or changes to any of the methods implemented and exposed by the module.
- Annotations
- @JSType() @native()
- Alphabetic
- By Inheritance
- Assert
- Object
- Any
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Value Members
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
##(): Int
- Definition Classes
- AnyRef → Any
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
apply(expression: Any, message: String = js.native): Unit
An alias of assert.ok() .
An alias of assert.ok() .
- expression
the expression to evaluate
assert(value[, message])
Example: -
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
def
clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( ... ) @native() @HotSpotIntrinsicCandidate()
-
def
deepStrictEqual(actual: Any, expected: Any, message: String = js.native): Unit
Generally identical to assert.deepEqual() with two exceptions.
Generally identical to assert.deepEqual() with two exceptions. First, primitive values are compared using the strict equality operator ( === ). Second, object comparisons include a strict equality check of their prototypes.
assert.deepStrictEqual(actual, expected[, message])
Example: - def doesNotReject(asyncFn: |[Function, Promise[_]], error: |[RegExp, Function] = js.native, message: String = js.native): Unit
-
def
doesNotThrow(block: Function, error: |[RegExp, Function] = js.native, message: String = js.native): Unit
Asserts that the function block does not throw an error.
Asserts that the function block does not throw an error. See assert.throws() for more details. When assert.doesNotThrow() is called, it will immediately call the block function. If an error is thrown and it is the same type as that specified by the error parameter, then an AssertionError is thrown. If the error is of a different type, or if the error parameter is undefined, the error is propagated back to the caller.
assert.doesNotThrow(block[, error][, message])
Example: -
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
fail(message: scala.scalajs.js.Error): Unit
- See also
https://nodejs.org/api/assert.html#assert_assert_fail_message
-
def
fail(message: String): Unit
- See also
https://nodejs.org/api/assert.html#assert_assert_fail_message
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @HotSpotIntrinsicCandidate()
-
def
hasOwnProperty(v: String): Boolean
- Definition Classes
- Object
-
def
hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @HotSpotIntrinsicCandidate()
-
def
ifError(value: Any): Unit
Throws value if value is truthy.
Throws value if value is truthy. This is useful when testing the error argument in callbacks.
assert.ifError(value)
Example: -
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
def
isPrototypeOf(v: Object): Boolean
- Definition Classes
- Object
-
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
notDeepStrictEqual(actual: Any, expected: Any, message: String = js.native): Unit
Tests for deep strict inequality.
Tests for deep strict inequality. Opposite of assert.deepStrictEqual().
assert.notDeepStrictEqual(actual, expected[, message])
Example: -
def
notStrictEqual(actual: Any, expected: Any, message: String = js.native): Unit
Tests strict inequality as determined by the strict not equal operator ( !== ).
Tests strict inequality as determined by the strict not equal operator ( !== ).
assert.notStrictEqual(actual, expected[, message])
Example: -
final
def
notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @HotSpotIntrinsicCandidate()
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @HotSpotIntrinsicCandidate()
-
def
ok(value: Any, message: String = js.native): Unit
Tests if value is truthy.
Tests if value is truthy. It is equivalent to assert.equal(!!value, true, message). If value is not truthy, an AssertionError is thrown with a message property set equal to the value of the message parameter. If the message parameter is undefined, a default error message is assigned.
-
def
propertyIsEnumerable(v: String): Boolean
- Definition Classes
- Object
- def rejects(asyncFn: |[Function, Promise[_]], error: |[|[|[RegExp, Function], Object], Error] = js.native, message: String = js.native): Unit
-
def
strictEqual(actual: Any, expected: Any, message: String = js.native): Unit
Tests strict equality as determined by the strict equality operator ( === ).
Tests strict equality as determined by the strict equality operator ( === ).
assert.strictEqual(actual, expected[, message])
Example: -
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
def
throws(block: Function, error: |[|[|[RegExp, Function], Object], Error], message: String = js.native): Unit
If the values are not strictly equal, an AssertionError is thrown with a message property set equal to the value of the message parameter.
If the values are not strictly equal, an AssertionError is thrown with a message property set equal to the value of the message parameter. If the message parameter is undefined, a default error message is assigned.
assert.throws(block[, error][, message])
Example: -
def
toLocaleString(): String
- Definition Classes
- Object
-
def
toString(): String
- Definition Classes
- AnyRef → Any
-
def
valueOf(): Any
- Definition Classes
- Object
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... ) @native()
-
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
Deprecated Value Members
-
def
fail(actual: Any, expected: Any, message: String, operator: String): Unit
- Annotations
- @deprecated
- Deprecated
(Since version Node.js v10.0.0) Use assert.fail([message]) or other assert functions instead.
-
def
finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] ) @Deprecated @deprecated
- Deprecated
(Since version ) see corresponding Javadoc for more information.