doc: add examples at assert.strictEqual
PR-URL: https://github.com/nodejs/node/pull/28092 Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com>
This commit is contained in:
parent
7e977d7cd4
commit
3ad87994ec
@ -1065,6 +1065,14 @@ assert.strictEqual('Hello foobar', 'Hello World!');
|
||||
// + 'Hello foobar'
|
||||
// - 'Hello World!'
|
||||
// ^
|
||||
|
||||
const apples = 1;
|
||||
const oranges = 2;
|
||||
assert.strictEqual(apples, oranges, `apples ${apples} !== oranges ${oranges}`);
|
||||
// AssertionError [ERR_ASSERTION]: apples 1 !== oranges 2
|
||||
|
||||
assert.strictEqual(1, '1', new TypeError('Inputs are not identical'));
|
||||
// TypeError: Inputs are not identical
|
||||
```
|
||||
|
||||
If the values are not strictly equal, an `AssertionError` is thrown with a
|
||||
|
Loading…
x
Reference in New Issue
Block a user