assert: add assert/strict alias module

Refs: https://github.com/nodejs/node/pull/31553
Refs: https://github.com/nodejs/node/pull/32953

PR-URL: https://github.com/nodejs/node/pull/34001
Refs: https://github.com/nodejs/node/pull/34002
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Zeyu Yang <himself65@outlook.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
This commit is contained in:
ExE Boss 2020-06-21 15:10:00 +02:00 committed by James M Snell
parent 88fb5a5c79
commit 50228cf6ff
No known key found for this signature in database
GPG Key ID: 7341B15C070877AC
5 changed files with 21 additions and 0 deletions

View File

@ -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
@ -37,6 +40,9 @@ To use strict assertion mode:
```js
const assert = require('assert').strict;
```
```js
const assert = require('assert/strict');
```
Example error diff:

3
lib/assert/strict.js Normal file
View File

@ -0,0 +1,3 @@
'use strict';
module.exports = require('assert').strict;

View File

@ -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',

View File

@ -0,0 +1,5 @@
import '../common/index.mjs';
import assert, { strict } from 'assert';
import assertStrict from 'assert/strict';
assert.strictEqual(strict, assertStrict);

View File

@ -0,0 +1,6 @@
'use strict';
require('../common');
const assert = require('assert');
assert.strictEqual(require('assert/strict'), assert.strict);