mirror of
https://github.com/nodejs/node.git
synced 2025-08-15 13:48:44 +02: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
5 changed files with 21 additions and 0 deletions
|
@ -11,6 +11,9 @@ invariants.
|
||||||
<!-- YAML
|
<!-- YAML
|
||||||
added: v9.9.0
|
added: v9.9.0
|
||||||
changes:
|
changes:
|
||||||
|
- version: REPLACEME
|
||||||
|
pr-url: https://github.com/nodejs/node/pull/34001
|
||||||
|
description: Exposed as `require('assert/strict')`
|
||||||
- version:
|
- version:
|
||||||
- v13.9.0
|
- v13.9.0
|
||||||
- v12.16.2
|
- v12.16.2
|
||||||
|
@ -37,6 +40,9 @@ To use strict assertion mode:
|
||||||
```js
|
```js
|
||||||
const assert = require('assert').strict;
|
const assert = require('assert').strict;
|
||||||
```
|
```
|
||||||
|
```js
|
||||||
|
const assert = require('assert/strict');
|
||||||
|
```
|
||||||
|
|
||||||
Example error diff:
|
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/internal/per_context/messageport.js',
|
||||||
'lib/async_hooks.js',
|
'lib/async_hooks.js',
|
||||||
'lib/assert.js',
|
'lib/assert.js',
|
||||||
|
'lib/assert/strict.js',
|
||||||
'lib/buffer.js',
|
'lib/buffer.js',
|
||||||
'lib/child_process.js',
|
'lib/child_process.js',
|
||||||
'lib/console.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…
Add table
Add a link
Reference in a new issue