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: improve assert strict-mode text #28239

Merged
merged 1 commit into from
Jun 17, 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
12 changes: 5 additions & 7 deletions doc/api/assert.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,8 @@
> Stability: 2 - Stable

The `assert` module provides a simple set of assertion tests that can be used to
test invariants.

A `strict` and a `legacy` mode exist, while it is recommended to only use
[`strict mode`][].
test invariants. The module provides a recommended [`strict` mode][] and a more
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 @@ -89,7 +87,7 @@ changes:
description: Added strict mode to the assert module.
-->

When using the `strict mode`, any `assert` function will use the equality used
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()`][].

Expand Down Expand Up @@ -140,7 +138,7 @@ It can be accessed using:
const assert = require('assert');
```

It is recommended to use the [`strict mode`][] instead as the
It is recommended to use the [`strict` mode][] instead as the
[Abstract Equality Comparison][] can often have surprising results. This is
especially true for [`assert.deepEqual()`][], where the comparison rules are
lax:
Expand Down Expand Up @@ -1288,7 +1286,7 @@ second argument. This might lead to difficult-to-spot errors.
[`assert.ok()`]: #assert_assert_ok_value_message
[`assert.strictEqual()`]: #assert_assert_strictequal_actual_expected_message
[`assert.throws()`]: #assert_assert_throws_fn_error_message
[`strict mode`]: #assert_strict_mode
[`strict` mode]: #assert_strict_mode
[Abstract Equality Comparison]: https://tc39.github.io/ecma262/#sec-abstract-equality-comparison
[Object wrappers]: https://developer.mozilla.org/en-US/docs/Glossary/Primitive#Primitive_wrapper_objects_in_JavaScript
[Object.prototype.toString()]: https://tc39.github.io/ecma262/#sec-object.prototype.tostring
Expand Down