Skip to content

Commit

Permalink
assert: add assert/strict alias module
Browse files Browse the repository at this point in the history
Refs: #31553
Refs: #32953

PR-URL: #34001
Refs: #34002
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Zeyu Yang <[email protected]>
Reviewed-By: Trivikram Kamat <[email protected]>
Reviewed-By: James M Snell <[email protected]>
  • Loading branch information
ExE-Boss authored and jasnell committed Jun 25, 2020
1 parent 88fb5a5 commit 50228cf
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 0 deletions.
6 changes: 6 additions & 0 deletions doc/api/assert.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ invariants.
<!-- YAML
added: v9.9.0
changes:
- version: REPLACEME
pr-url: https://github.com/nodejs/node/pull/34001
description: Exposed as `require('assert/strict')`
- version:
- v13.9.0
- v12.16.2
Expand All @@ -37,6 +40,9 @@ To use strict assertion mode:
```js
const assert = require('assert').strict;
```
```js
const assert = require('assert/strict');
```

Example error diff:

Expand Down
3 changes: 3 additions & 0 deletions lib/assert/strict.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
'use strict';

module.exports = require('assert').strict;
1 change: 1 addition & 0 deletions node.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
'lib/internal/per_context/messageport.js',
'lib/async_hooks.js',
'lib/assert.js',
'lib/assert/strict.js',
'lib/buffer.js',
'lib/child_process.js',
'lib/console.js',
Expand Down
5 changes: 5 additions & 0 deletions test/es-module/test-esm-assert-strict.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import '../common/index.mjs';
import assert, { strict } from 'assert';
import assertStrict from 'assert/strict';

assert.strictEqual(strict, assertStrict);
6 changes: 6 additions & 0 deletions test/parallel/test-assert-strict-exists.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
'use strict';

require('../common');
const assert = require('assert');

assert.strictEqual(require('assert/strict'), assert.strict);

0 comments on commit 50228cf

Please sign in to comment.