Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

assert: add assert/strict alias module #34001

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 6 additions & 0 deletions doc/api/assert.md
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
@@ -0,0 +1,3 @@
'use strict';

module.exports = require('assert').strict;
1 change: 1 addition & 0 deletions node.gyp
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
@@ -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
@@ -0,0 +1,6 @@
'use strict';

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

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