Packages

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()
Linear Supertypes
Known Subclasses
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. Assert
  2. Object
  3. Any
  4. AnyRef
  5. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##: Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. def apply(expression: Any, message: String = js.native): Unit

    An alias of assert.ok() .

    An alias of assert.ok() .

    expression

    the expression to evaluate

    Example:
    1. assert(value[, message])

  5. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  6. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.CloneNotSupportedException]) @native() @HotSpotIntrinsicCandidate()
  7. 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.

    Example:
    1. assert.deepStrictEqual(actual, expected[, message])

  8. def doesNotReject(asyncFn: |[Function, Promise[_]], error: |[RegExp, Function] = js.native, message: String = js.native): Unit
  9. 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.

    Example:
    1. assert.doesNotThrow(block[, error][, message])

  10. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  11. def equals(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef → Any
  12. def fail(message: scala.scalajs.js.Error): Unit

    See also

    https://nodejs.org/api/assert.html#assert_assert_fail_message

  13. def fail(message: String): Unit

    See also

    https://nodejs.org/api/assert.html#assert_assert_fail_message

  14. final def getClass(): Class[_ <: AnyRef]
    Definition Classes
    AnyRef → Any
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  15. def hasOwnProperty(v: String): Boolean
    Definition Classes
    Object
  16. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  17. 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.

    Example:
    1. assert.ifError(value)

  18. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  19. def isPrototypeOf(v: Object): Boolean
    Definition Classes
    Object
  20. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  21. 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().

    Example:
    1. assert.notDeepStrictEqual(actual, expected[, message])

  22. 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 ( !== ).

    Example:
    1. assert.notStrictEqual(actual, expected[, message])

  23. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  24. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  25. 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.

  26. def propertyIsEnumerable(v: String): Boolean
    Definition Classes
    Object
  27. def rejects(asyncFn: |[Function, Promise[_]], error: |[|[|[RegExp, Function], Object], Error] = js.native, message: String = js.native): Unit
  28. 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 ( === ).

    Example:
    1. assert.strictEqual(actual, expected[, message])

  29. final def synchronized[T0](arg0: => T0): T0
    Definition Classes
    AnyRef
  30. 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.

    Example:
    1. assert.throws(block[, error][, message])

  31. def toLocaleString(): String
    Definition Classes
    Object
  32. def toString(): String
    Definition Classes
    AnyRef → Any
  33. def valueOf(): Any
    Definition Classes
    Object
  34. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  35. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException]) @native()
  36. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])

Deprecated Value Members

  1. 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.

  2. 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.

Inherited from Object

Inherited from Any

Inherited from AnyRef

Inherited from Any

Ungrouped