mirror of
https://github.com/nodejs/node.git
synced 2024-11-21 10:59:27 +00:00
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:
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:
|
||||
|
||||
|
3
lib/assert/strict.js
Normal file
3
lib/assert/strict.js
Normal file
@ -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',
|
||||
|
5
test/es-module/test-esm-assert-strict.mjs
Normal file
5
test/es-module/test-esm-assert-strict.mjs
Normal file
@ -0,0 +1,5 @@
|
||||
import '../common/index.mjs';
|
||||
import assert, { strict } from 'assert';
|
||||
import assertStrict from 'assert/strict';
|
||||
|
||||
assert.strictEqual(strict, assertStrict);
|
6
test/parallel/test-assert-strict-exists.js
Normal file
6
test/parallel/test-assert-strict-exists.js
Normal file
@ -0,0 +1,6 @@
|
||||
'use strict';
|
||||
|
||||
require('../common');
|
||||
const assert = require('assert');
|
||||
|
||||
assert.strictEqual(require('assert/strict'), assert.strict);
|
Loading…
Reference in New Issue
Block a user