Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

doc: revise strict mode text in assert #28285

Merged
merged 1 commit into from
Jun 21, 2019
Merged
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
14 changes: 7 additions & 7 deletions doc/api/assert.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

The `assert` module provides a set of assertion functions for verifying
invariants. The module provides a recommended [`strict` mode][] and a more
lenient `legacy` mode.
lenient legacy mode.

For more information about the used equality comparisons see
[MDN's guide on equality comparisons and sameness][mdn-equality-guide].
Expand Down Expand Up @@ -80,14 +80,14 @@ changes:
description: Added strict mode to the assert module.
-->

When using the `strict` mode, any `assert` function will use the equality used
in the strict function mode. So [`assert.deepEqual()`][] will, for example,
work the same as [`assert.deepStrictEqual()`][].
In `strict` mode, `assert` functions use the comparison in the corresponding
strict functions. For example, [`assert.deepEqual()`][] will behave like
[`assert.deepStrictEqual()`][].

On top of that, error messages which involve objects produce an error diff
instead of displaying both objects. That is not the case for the legacy mode.
In `strict` mode, error messages for objects display a diff. In legacy mode,
error messages for objects display the objects, often truncated.

It can be accessed using:
To use `strict` mode:

```js
const assert = require('assert').strict;
Expand Down