mirror of https://github.com/nodejs/node.git
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>pull/31038/merge
parent
88fb5a5c79
commit
50228cf6ff
|
@ -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:
|
||||
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
'use strict';
|
||||
|
||||
module.exports = require('assert').strict;
|
1
node.gyp
1
node.gyp
|
@ -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',
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
import '../common/index.mjs';
|
||||
import assert, { strict } from 'assert';
|
||||
import assertStrict from 'assert/strict';
|
||||
|
||||
assert.strictEqual(strict, assertStrict);
|
|
@ -0,0 +1,6 @@
|
|||
'use strict';
|
||||
|
||||
require('../common');
|
||||
const assert = require('assert');
|
||||
|
||||
assert.strictEqual(require('assert/strict'), assert.strict);
|
Loading…
Reference in New Issue