@@ -11,43 +11,43 @@ import * as util from './utils/index.js';
11
11
12
12
export class Assertion {
13
13
/** @type {{} } */
14
- __flags = { }
15
-
16
- /**
17
- * Creates object for chaining.
18
- * `Assertion` objects contain metadata in the form of flags. Three flags can
19
- * be assigned during instantiation by passing arguments to this constructor:
20
- *
21
- * - `object`: This flag contains the target of the assertion. For example, in
22
- * the assertion `expect(numKittens).to.equal(7);`, the `object` flag will
23
- * contain `numKittens` so that the `equal` assertion can reference it when
24
- * needed.
25
- *
26
- * - `message`: This flag contains an optional custom error message to be
27
- * prepended to the error message that's generated by the assertion when it
28
- * fails.
29
- *
30
- * - `ssfi`: This flag stands for "start stack function indicator". It
31
- * contains a function reference that serves as the starting point for
32
- * removing frames from the stack trace of the error that's created by the
33
- * assertion when it fails. The goal is to provide a cleaner stack trace to
34
- * end users by removing Chai's internal functions. Note that it only works
35
- * in environments that support `Error.captureStackTrace`, and only when
36
- * `Chai.config.includeStack` hasn't been set to `false`.
37
- *
38
- * - `lockSsfi`: This flag controls whether or not the given `ssfi` flag
39
- * should retain its current value, even as assertions are chained off of
40
- * this object. This is usually set to `true` when creating a new assertion
41
- * from within another assertion. It's also temporarily set to `true` before
42
- * an overwritten assertion gets called by the overwriting assertion.
43
- *
44
- * - `eql`: This flag contains the deepEqual function to be used by the assertion.
45
- *
46
- * @param {unknown } obj target of the assertion
47
- * @param {string } [msg] (optional) custom error message
48
- * @param {Function } [ssfi] (optional) starting point for removing stack frames
49
- * @param {boolean } [lockSsfi] (optional) whether or not the ssfi flag is locked
50
- */
14
+ __flags = { } ;
15
+
16
+ /**
17
+ * Creates object for chaining.
18
+ * `Assertion` objects contain metadata in the form of flags. Three flags can
19
+ * be assigned during instantiation by passing arguments to this constructor:
20
+ *
21
+ * - `object`: This flag contains the target of the assertion. For example, in
22
+ * the assertion `expect(numKittens).to.equal(7);`, the `object` flag will
23
+ * contain `numKittens` so that the `equal` assertion can reference it when
24
+ * needed.
25
+ *
26
+ * - `message`: This flag contains an optional custom error message to be
27
+ * prepended to the error message that's generated by the assertion when it
28
+ * fails.
29
+ *
30
+ * - `ssfi`: This flag stands for "start stack function indicator". It
31
+ * contains a function reference that serves as the starting point for
32
+ * removing frames from the stack trace of the error that's created by the
33
+ * assertion when it fails. The goal is to provide a cleaner stack trace to
34
+ * end users by removing Chai's internal functions. Note that it only works
35
+ * in environments that support `Error.captureStackTrace`, and only when
36
+ * `Chai.config.includeStack` hasn't been set to `false`.
37
+ *
38
+ * - `lockSsfi`: This flag controls whether or not the given `ssfi` flag
39
+ * should retain its current value, even as assertions are chained off of
40
+ * this object. This is usually set to `true` when creating a new assertion
41
+ * from within another assertion. It's also temporarily set to `true` before
42
+ * an overwritten assertion gets called by the overwriting assertion.
43
+ *
44
+ * - `eql`: This flag contains the deepEqual function to be used by the assertion.
45
+ *
46
+ * @param {unknown } obj target of the assertion
47
+ * @param {string } [msg] (optional) custom error message
48
+ * @param {Function } [ssfi] (optional) starting point for removing stack frames
49
+ * @param {boolean } [lockSsfi] (optional) whether or not the ssfi flag is locked
50
+ */
51
51
constructor ( obj , msg , ssfi , lockSsfi ) {
52
52
util . flag ( this , 'ssfi' , ssfi || Assertion ) ;
53
53
util . flag ( this , 'lockSsfi' , lockSsfi ) ;
@@ -155,22 +155,22 @@ export class Assertion {
155
155
* @returns {void }
156
156
*/
157
157
assert ( _expr , msg , _negateMsg , expected , _actual , showDiff ) {
158
- var ok = util . test ( this , arguments ) ;
158
+ const ok = util . test ( this , arguments ) ;
159
159
if ( false !== showDiff ) showDiff = true ;
160
160
if ( undefined === expected && undefined === _actual ) showDiff = false ;
161
161
if ( true !== config . showDiff ) showDiff = false ;
162
162
163
163
if ( ! ok ) {
164
164
msg = util . getMessage ( this , arguments ) ;
165
- var actual = util . getActual ( this , arguments ) ;
165
+ const actual = util . getActual ( this , arguments ) ;
166
166
/** @type {Record<PropertyKey, unknown> } */
167
- var assertionErrorObjectProperties = {
167
+ const assertionErrorObjectProperties = {
168
168
actual : actual ,
169
169
expected : expected ,
170
170
showDiff : showDiff
171
171
} ;
172
172
173
- var operator = util . getOperator ( this , arguments ) ;
173
+ const operator = util . getOperator ( this , arguments ) ;
174
174
if ( operator ) {
175
175
assertionErrorObjectProperties . operator = operator ;
176
176
}
0 commit comments