1
+ package io .scalajs .nodejs
2
+
3
+ import io .scalajs .nodejs .events .IEventEmitter
4
+
5
+ import scala .scalajs .js
6
+ import scala .scalajs .js .annotation .JSImport
7
+
8
+ /**
9
+ * The assert module provides a simple set of assertion tests that can be used to test invariants. The module is
10
+ * intended for internal use by Node.js, but can be used in application code via require('assert'). However, assert
11
+ * is not a testing framework, and is not intended to be used as a general purpose assertion library.
12
+ *
13
+ * The API for the assert module is Locked. This means that there will be no additions or changes to any of the
14
+ * methods implemented and exposed by the module.
15
+ * @author lawrence.daniels@gmail.com
16
+ */
17
+ @ js.native
18
+ trait Assert extends IEventEmitter {
19
+
20
+ /**
21
+ * An alias of assert.ok() .
22
+ * @param expression the expression to evaluate
23
+ * @example assert(value[, message])
24
+ */
25
+ def apply (expression : js.Any , message : String = js.native): Unit = js.native
26
+
27
+ /**
28
+ * Tests for deep equality between the actual and expected parameters. Primitive values are compared with the equal
29
+ * comparison operator ( == ). Only enumerable "own" properties are considered. The deepEqual() implementation does
30
+ * not test object prototypes, attached symbols, or non-enumerable properties. This can lead to some potentially
31
+ * surprising results.
32
+ * @example assert.deepEqual(actual, expected[, message])
33
+ */
34
+ def deepEqual (actual : js.Any , expected : js.Any , message : String = js.native): Unit = js.native
35
+
36
+ /**
37
+ * Generally identical to assert.deepEqual() with two exceptions. First, primitive values are compared using the
38
+ * strict equality operator ( === ). Second, object comparisons include a strict equality check of their prototypes.
39
+ * @example assert.deepStrictEqual(actual, expected[, message])
40
+ */
41
+ def deepStrictEqual (actual : js.Any , expected : js.Any , message : String ): Unit = js.native
42
+
43
+ /**
44
+ * Asserts that the function block does not throw an error. See assert.throws() for more details.
45
+ * When assert.doesNotThrow() is called, it will immediately call the block function. If an error is thrown
46
+ * and it is the same type as that specified by the error parameter, then an AssertionError is thrown. If the
47
+ * error is of a different type, or if the error parameter is undefined, the error is propagated back to the caller.
48
+ * @example assert.doesNotThrow(block[, error][, message])
49
+ */
50
+ def doesNotThrow (block : js.Function , error : js.Any , message : String ): Unit = js.native
51
+
52
+ /**
53
+ * Asserts that the function block does not throw an error. See assert.throws() for more details.
54
+ * When assert.doesNotThrow() is called, it will immediately call the block function. If an error is thrown
55
+ * and it is the same type as that specified by the error parameter, then an AssertionError is thrown. If the
56
+ * error is of a different type, or if the error parameter is undefined, the error is propagated back to the caller.
57
+ * @example assert.doesNotThrow(block[, error][, message])
58
+ */
59
+ def doesNotThrow (block : js.Function , message : String ): Unit = js.native
60
+
61
+ /**
62
+ * Asserts that the function block does not throw an error. See assert.throws() for more details.
63
+ * When assert.doesNotThrow() is called, it will immediately call the block function. If an error is thrown
64
+ * and it is the same type as that specified by the error parameter, then an AssertionError is thrown. If the
65
+ * error is of a different type, or if the error parameter is undefined, the error is propagated back to the caller.
66
+ * @example assert.doesNotThrow(block[, error][, message])
67
+ */
68
+ def doesNotThrow (block : js.Function , error : js.Any = js.native): Unit = js.native
69
+
70
+ /**
71
+ * Tests shallow, coercive equality between the actual and expected parameters using the equal comparison operator ( == ).
72
+ * @example assert.equal(actual, expected[, message])
73
+ */
74
+ def equal (actual : js.Any , expected : js.Any , message : String = js.native): Unit = js.native
75
+
76
+ /**
77
+ * Throws an AssertionError. If message is falsy, the error message is set as the values of actual and expected
78
+ * separated by the provided operator. Otherwise, the error message is the value of message.
79
+ * @example assert.fail(actual, expected, message, operator)
80
+ */
81
+ def fail (actual : js.Any , expected : js.Any , message : String , operator : String ): Unit = js.native
82
+
83
+ /**
84
+ * Throws value if value is truthy. This is useful when testing the error argument in callbacks.
85
+ * @example assert.ifError(value)
86
+ */
87
+ def ifError (value : js.Any ): Unit = js.native
88
+
89
+ /**
90
+ * Tests for any deep inequality. Opposite of assert.deepEqual().
91
+ * @example assert.notDeepEqual(actual, expected[, message])
92
+ */
93
+ def notDeepEqual (actual : js.Any , expected : js.Any , message : String = js.native): Unit = js.native
94
+
95
+ /**
96
+ * Tests for deep strict inequality. Opposite of assert.deepStrictEqual().
97
+ * @example assert.notDeepStrictEqual(actual, expected[, message])
98
+ */
99
+ def notDeepStrictEqual (actual : js.Any , expected : js.Any , message : String = js.native): Unit = js.native
100
+
101
+ /**
102
+ * Tests shallow, coercive inequality with the not equal comparison operator ( != ).
103
+ * @example assert.notEqual(actual, expected[, message])
104
+ */
105
+ def notEqual (actual : js.Any , expected : js.Any , message : String = js.native): Unit = js.native
106
+
107
+ /**
108
+ * Tests strict inequality as determined by the strict not equal operator ( !== ).
109
+ * @example assert.notStrictEqual(actual, expected[, message])
110
+ */
111
+ def notStrictEqual (actual : js.Any , expected : js.Any , message : String = js.native): Unit = js.native
112
+
113
+ /**
114
+ * Tests if value is truthy. It is equivalent to assert.equal(!!value, true, message). If value is not truthy,
115
+ * an AssertionError is thrown with a message property set equal to the value of the message parameter. If the
116
+ * message parameter is undefined, a default error message is assigned.
117
+ */
118
+ def ok (value : js.Any , message : String = js.native): Unit = js.native
119
+
120
+ /**
121
+ * Tests strict equality as determined by the strict equality operator ( === ).
122
+ * @example assert.strictEqual(actual, expected[, message])
123
+ */
124
+ def strictEqual (actual : js.Any , expected : js.Any , message : String = js.native): Unit = js.native
125
+
126
+ /**
127
+ * If the values are not strictly equal, an AssertionError is thrown with a message property set equal to the value
128
+ * of the message parameter. If the message parameter is undefined, a default error message is assigned.
129
+ * @example assert.throws(block[, error][, message])
130
+ */
131
+ def throws (block : js.Function , error : js.Any , message : String = js.native): Unit = js.native
132
+
133
+ }
134
+
135
+ /**
136
+ * Assert Singleton
137
+ * @author lawrence.daniels@gmail.com
138
+ */
139
+ @ js.native
140
+ @ JSImport (" assert" , JSImport .Namespace )
141
+ object Assert extends Assert
0 commit comments