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: https://github.com/nodejs/node/pull/25956
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Minwoo Jung <minwoo@nodesource.com>
pull/26008/head
Rich Trott 2019-02-05 20:46:35 -08:00
parent 7182aca108
commit 64745c3ade
3 changed files with 3 additions and 5 deletions

View File

@ -27,7 +27,7 @@ const { codes: {
ERR_INVALID_ARG_VALUE,
ERR_INVALID_RETURN_VALUE
} } = require('internal/errors');
const { AssertionError } = require('internal/assert');
const AssertionError = require('internal/assert/assertion_error');
const { openSync, closeSync, readSync } = require('fs');
const { inspect, types: { isPromise, isRegExp } } = require('util');
const { EOL } = require('internal/constants');

View File

@ -405,6 +405,4 @@ class AssertionError extends Error {
}
}
module.exports = {
AssertionError
};
module.exports = AssertionError;

View File

@ -85,7 +85,7 @@
'lib/vm.js',
'lib/worker_threads.js',
'lib/zlib.js',
'lib/internal/assert.js',
'lib/internal/assert/assertion_error.js',
'lib/internal/async_hooks.js',
'lib/internal/buffer.js',
'lib/internal/cli_table.js',