Skip to content

Commit

Permalink
doc: add examples at assert.strictEqual
Browse files Browse the repository at this point in the history
PR-URL: #28092
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
  • Loading branch information
himself65 authored and targos committed Jul 20, 2019
1 parent d611f5a commit 3f78a51
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions doc/api/assert.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 3f78a51

Please sign in to comment.