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): Unit
  5. def apply(expression: Any, message: String): Unit

    An alias of assert.ok() .

    An alias of assert.ok() .

    expression

    the expression to evaluate

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

  6. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  7. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.CloneNotSupportedException]) @native()
  8. def deepStrictEqual(actual: Any, expected: Any): Unit
  9. 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.

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

  10. def doesNotReject(asyncFn: Promise[_]): Unit
  11. def doesNotReject(asyncFn: Promise[_], message: String): Unit
  12. def doesNotReject(asyncFn: Promise[_], error: Function): Unit
  13. def doesNotReject(asyncFn: Promise[_], error: Function, message: String): Unit
  14. def doesNotReject(asyncFn: Promise[_], error: RegExp): Unit
  15. def doesNotReject(asyncFn: Promise[_], error: RegExp, message: String): Unit
  16. def doesNotReject(asyncFn: Function): Unit
  17. def doesNotReject(asyncFn: Function, message: String): Unit
  18. def doesNotReject(asyncFn: Function, error: Function): Unit
  19. def doesNotReject(asyncFn: Function, error: Function, message: String): Unit
  20. def doesNotReject(asyncFn: Function, error: RegExp): Unit
  21. def doesNotReject(asyncFn: Function, error: RegExp, message: String): Unit
  22. def doesNotThrow(block: Function): Unit
  23. def doesNotThrow(block: Function, message: String): Unit
  24. def doesNotThrow(block: Function, error: Function): Unit
  25. def doesNotThrow(block: Function, error: Function, message: String): Unit
  26. def doesNotThrow(block: Function, error: RegExp): Unit
  27. 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.

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

  28. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  29. def equals(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef → Any
  30. def fail(message: scala.scalajs.js.Error): Unit

    See also

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

  31. def fail(message: String): Unit

    See also

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

  32. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.Throwable])
  33. final def getClass(): Class[_ <: AnyRef]
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  34. def hasOwnProperty(v: String): Boolean
    Definition Classes
    Object
  35. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  36. 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)

  37. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  38. def isPrototypeOf(v: Object): Boolean
    Definition Classes
    Object
  39. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  40. def notDeepStrictEqual(actual: Any, expected: Any): Unit
  41. def notDeepStrictEqual(actual: Any, expected: Any, message: String): Unit

    Tests for deep strict inequality.

    Tests for deep strict inequality. Opposite of assert.deepStrictEqual().

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

  42. def notStrictEqual(actual: Any, expected: Any): Unit
  43. 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 ( !== ).

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

  44. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  45. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  46. def ok(value: Any): Unit
  47. 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.

  48. def propertyIsEnumerable(v: String): Boolean
    Definition Classes
    Object
  49. def rejects(asyncFn: Promise[_]): Unit
  50. def rejects(asyncFn: Promise[_], message: String): Unit
  51. def rejects(asyncFn: Promise[_], error: Object): Unit
  52. def rejects(asyncFn: Promise[_], error: Object, message: String): Unit
  53. def rejects(asyncFn: Function): Unit
  54. def rejects(asyncFn: Function, message: String): Unit
  55. def rejects(asyncFn: Function, error: Object): Unit
  56. def rejects(asyncFn: Function, error: Object, message: String): Unit
  57. def strictEqual(actual: Any, expected: Any): Unit
  58. 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 ( === ).

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

  59. final def synchronized[T0](arg0: => T0): T0
    Definition Classes
    AnyRef
  60. def throws(block: Function, error: Object): Unit
  61. 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.

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

  62. def toLocaleString(): String
    Definition Classes
    Object
  63. def toString(): String
    Definition Classes
    AnyRef → Any
  64. def valueOf(): Any
    Definition Classes
    Object
  65. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  66. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  67. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException]) @native()

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.

Inherited from Object

Inherited from Any

Inherited from AnyRef

Inherited from Any

Ungrouped