Skip to content

Commit a9e2626

Browse files
committed
doc,assert: rename "mode" to "assertion mode"
Rename "strict mode" in the assert module to "strict assertion mode". This is to avoid confusion with the more typical meaning of "strict mode" in ECMAScript. This necessitates a corresponding change of "legacy mode" to "legacy assertion mode". PR-URL: #31635 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]>
1 parent efd5a6b commit a9e2626

File tree

1 file changed

+28
-24
lines changed

1 file changed

+28
-24
lines changed

doc/api/assert.md

Lines changed: 28 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
> Stability: 2 - Stable
66
77
The `assert` module provides a set of assertion functions for verifying
8-
invariants. The module provides a recommended [`strict` mode][] and a more
9-
lenient legacy mode.
8+
invariants. The module provides a recommended [strict assertion mode][]
9+
and a more lenient legacy assertion mode.
1010

1111
## Class: assert.AssertionError
1212

@@ -68,26 +68,30 @@ try {
6868
}
6969
```
7070

71-
## Strict mode
71+
## Strict assertion mode
7272
<!-- YAML
7373
added: v9.9.0
7474
changes:
75+
- version: REPLACEME
76+
description: Changed "strict mode" to "strict assertion mode" and "legacy
77+
mode" to "legacy assertion mode" to avoid confusion with the
78+
more usual meaining of "strict mode".
7579
- version: v9.9.0
7680
pr-url: https://github.com/nodejs/node/pull/17615
77-
description: Added error diffs to the strict mode
81+
description: Added error diffs to the strict assertion mode.
7882
- version: v9.9.0
7983
pr-url: https://github.com/nodejs/node/pull/17002
80-
description: Added strict mode to the assert module.
84+
description: Added strict assertion mode to the assert module.
8185
-->
8286

83-
In `strict` mode (not to be confused with `"use strict"`), `assert` functions
84-
use the comparison in the corresponding strict functions. For example,
85-
[`assert.deepEqual()`][] will behave like [`assert.deepStrictEqual()`][].
87+
In strict assertion mode, `assert` functions use the comparison in the
88+
corresponding strict functions. For example, [`assert.deepEqual()`][] will
89+
behave like [`assert.deepStrictEqual()`][].
8690

87-
In `strict` mode, error messages for objects display a diff. In legacy mode,
88-
error messages for objects display the objects, often truncated.
91+
In strict assertion mode, error messages for objects display a diff. In legacy
92+
assertion mode, error messages for objects display the objects, often truncated.
8993

90-
To use `strict` mode:
94+
To use strict assertion mode:
9195

9296
```js
9397
const assert = require('assert').strict;
@@ -121,22 +125,22 @@ This will also deactivate the colors in the REPL.
121125
For more on the color support in terminal environments, read
122126
the tty [getColorDepth()](tty.html#tty_writestream_getcolordepth_env) doc.
123127

124-
## Legacy mode
128+
## Legacy assertion mode
125129

126-
Legacy mode uses the [Abstract Equality Comparison][] in:
130+
Legacy assertion mode uses the [Abstract Equality Comparison][] in:
127131

128132
* [`assert.deepEqual()`][]
129133
* [`assert.equal()`][]
130134
* [`assert.notDeepEqual()`][]
131135
* [`assert.notEqual()`][]
132136

133-
To use legacy mode:
137+
To use legacy assertion mode:
134138

135139
```js
136140
const assert = require('assert');
137141
```
138142

139-
Whenever possible, use the [`strict` mode][] instead. Otherwise, the
143+
Whenever possible, use the [strict assertion mode][] instead. Otherwise, the
140144
[Abstract Equality Comparison][] may cause surprising results. This is
141145
especially true for [`assert.deepEqual()`][], where the comparison rules are
142146
lax:
@@ -189,11 +193,11 @@ changes:
189193
* `expected` {any}
190194
* `message` {string|Error}
191195

192-
**Strict mode**
196+
**Strict assertion mode**
193197

194198
An alias of [`assert.deepStrictEqual()`][].
195199

196-
**Legacy mode**
200+
**Legacy assertion mode**
197201

198202
> Stability: 0 - Deprecated: Use [`assert.deepStrictEqual()`][] instead.
199203
@@ -606,11 +610,11 @@ changes:
606610
* `expected` {any}
607611
* `message` {string|Error}
608612

609-
**Strict mode**
613+
**Strict assertion mode**
610614

611615
An alias of [`assert.strictEqual()`][].
612616

613-
**Legacy mode**
617+
**Legacy assertion mode**
614618

615619
> Stability: 0 - Deprecated: Use [`assert.strictEqual()`][] instead.
616620
@@ -842,11 +846,11 @@ changes:
842846
* `expected` {any}
843847
* `message` {string|Error}
844848

845-
**Strict mode**
849+
**Strict assertion mode**
846850

847851
An alias of [`assert.notDeepStrictEqual()`][].
848852

849-
**Legacy mode**
853+
**Legacy assertion mode**
850854

851855
> Stability: 0 - Deprecated: Use [`assert.notDeepStrictEqual()`][] instead.
852856
@@ -953,11 +957,11 @@ changes:
953957
* `expected` {any}
954958
* `message` {string|Error}
955959

956-
**Strict mode**
960+
**Strict assertion mode**
957961

958962
An alias of [`assert.notStrictEqual()`][].
959963

960-
**Legacy mode**
964+
**Legacy assertion mode**
961965

962966
> Stability: 0 - Deprecated: Use [`assert.notStrictEqual()`][] instead.
963967
@@ -1418,7 +1422,7 @@ argument.
14181422
[`assert.ok()`]: #assert_assert_ok_value_message
14191423
[`assert.strictEqual()`]: #assert_assert_strictequal_actual_expected_message
14201424
[`assert.throws()`]: #assert_assert_throws_fn_error_message
1421-
[`strict` mode]: #assert_strict_mode
1425+
[strict assertion mode]: #assert_strict_assertion_mode
14221426
[Abstract Equality Comparison]: https://tc39.github.io/ecma262/#sec-abstract-equality-comparison
14231427
[Object wrappers]: https://developer.mozilla.org/en-US/docs/Glossary/Primitive#Primitive_wrapper_objects_in_JavaScript
14241428
[Object.prototype.toString()]: https://tc39.github.io/ecma262/#sec-object.prototype.tostring

0 commit comments

Comments
 (0)