Skip to content

Commit 37d207c

Browse files
Trottaddaleax
authored andcommitted
assert: refactor internal assert.js
Move lib/internal/assert.js to lib/internal/assert/assertion_error.js. This is in preparation for making lib/internal/assert.js a tiny module for use in Node.js built-ins so that we can use `assert()` without having to load the entire ~1200 line `assert` module. PR-URL: #25956 Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Minwoo Jung <minwoo@nodesource.com>
1 parent 55a313b commit 37d207c

File tree

3 files changed

+3
-5
lines changed

3 files changed

+3
-5
lines changed

lib/assert.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ const { codes: {
2727
ERR_INVALID_ARG_VALUE,
2828
ERR_INVALID_RETURN_VALUE
2929
} } = require('internal/errors');
30-
const { AssertionError } = require('internal/assert');
30+
const AssertionError = require('internal/assert/assertion_error');
3131
const { openSync, closeSync, readSync } = require('fs');
3232
const { inspect, types: { isPromise, isRegExp } } = require('util');
3333
const { EOL } = require('internal/constants');

lib/internal/assert.js lib/internal/assert/assertion_error.js

+1-3
Original file line numberDiff line numberDiff line change
@@ -405,6 +405,4 @@ class AssertionError extends Error {
405405
}
406406
}
407407

408-
module.exports = {
409-
AssertionError
410-
};
408+
module.exports = AssertionError;

node.gyp

+1-1
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@
8484
'lib/vm.js',
8585
'lib/worker_threads.js',
8686
'lib/zlib.js',
87-
'lib/internal/assert.js',
87+
'lib/internal/assert/assertion_error.js',
8888
'lib/internal/async_hooks.js',
8989
'lib/internal/bash_completion.js',
9090
'lib/internal/buffer.js',

0 commit comments

Comments
 (0)