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
- Protected
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): Unit
- def apply(expression: Any, message: String): 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(classOf[java.lang.CloneNotSupportedException]) @native()
- def deepStrictEqual(actual: Any, expected: Any): Unit
- def deepStrictEqual(actual: Any, expected: Any, message: String): 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: Promise[_]): Unit
- def doesNotReject(asyncFn: Promise[_], message: String): Unit
- def doesNotReject(asyncFn: Promise[_], error: Function): Unit
- def doesNotReject(asyncFn: Promise[_], error: Function, message: String): Unit
- def doesNotReject(asyncFn: Promise[_], error: RegExp): Unit
- def doesNotReject(asyncFn: Promise[_], error: RegExp, message: String): Unit
- def doesNotReject(asyncFn: Function): Unit
- def doesNotReject(asyncFn: Function, message: String): Unit
- def doesNotReject(asyncFn: Function, error: Function): Unit
- def doesNotReject(asyncFn: Function, error: Function, message: String): Unit
- def doesNotReject(asyncFn: Function, error: RegExp): Unit
- def doesNotReject(asyncFn: Function, error: RegExp, message: String): Unit
- def doesNotThrow(block: Function): Unit
- def doesNotThrow(block: Function, message: String): Unit
- def doesNotThrow(block: Function, error: Function): Unit
- def doesNotThrow(block: Function, error: Function, message: String): Unit
- def doesNotThrow(block: Function, error: RegExp): Unit
- def doesNotThrow(block: Function, error: RegExp, message: String): 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: AnyRef): 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
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable])
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- def hasOwnProperty(v: String): Boolean
- Definition Classes
- Object
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- 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): Unit
- def notDeepStrictEqual(actual: Any, expected: Any, message: String): 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): Unit
- def notStrictEqual(actual: Any, expected: Any, message: String): 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()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- def ok(value: Any): Unit
- def ok(value: Any, message: String): 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: Promise[_]): Unit
- def rejects(asyncFn: Promise[_], message: String): Unit
- def rejects(asyncFn: Promise[_], error: Object): Unit
- def rejects(asyncFn: Promise[_], error: Object, message: String): Unit
- def rejects(asyncFn: Function): Unit
- def rejects(asyncFn: Function, message: String): Unit
- def rejects(asyncFn: Function, error: Object): Unit
- def rejects(asyncFn: Function, error: Object, message: String): Unit
- def strictEqual(actual: Any, expected: Any): Unit
- def strictEqual(actual: Any, expected: Any, message: String): 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: Object): Unit
- def throws(block: Function, error: Object, message: String): 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(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()