Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
doc: add examples at assert.strictEqual
  • Loading branch information
himself65 committed Jul 16, 2019
commit d93cdf1270af4f33f0231186ff6386081848a5ec
8 changes: 8 additions & 0 deletions doc/api/assert.md
Original file line number Diff line number Diff line change
Expand Up @@ -1074,6 +1074,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