@@ -25,7 +25,7 @@ const {
25
25
isDeepEqual,
26
26
isDeepStrictEqual
27
27
} = require ( 'internal/util/comparisons' ) ;
28
- const errors = require ( 'internal/errors' ) ;
28
+ const { AssertionError , TypeError } = require ( 'internal/errors' ) ;
29
29
const { openSync, closeSync, readSync } = require ( 'fs' ) ;
30
30
const { parseExpressionAt } = require ( 'internal/deps/acorn/dist/acorn' ) ;
31
31
const { inspect } = require ( 'util' ) ;
@@ -65,7 +65,7 @@ const NO_EXCEPTION_SENTINEL = {};
65
65
function innerFail ( obj ) {
66
66
if ( obj . message instanceof Error ) throw obj . message ;
67
67
68
- throw new errors . AssertionError ( obj ) ;
68
+ throw new AssertionError ( obj ) ;
69
69
}
70
70
71
71
function fail ( actual , expected , message , operator , stackStartFn ) {
@@ -95,7 +95,7 @@ assert.fail = fail;
95
95
// new assert.AssertionError({ message: message,
96
96
// actual: actual,
97
97
// expected: expected });
98
- assert . AssertionError = errors . AssertionError ;
98
+ assert . AssertionError = AssertionError ;
99
99
100
100
function getBuffer ( fd , assertLine ) {
101
101
var lines = 0 ;
@@ -134,7 +134,7 @@ function innerOk(args, fn) {
134
134
var [ value , message ] = args ;
135
135
136
136
if ( args . length === 0 )
137
- throw new errors . TypeError ( 'ERR_MISSING_ARGS' , 'value' ) ;
137
+ throw new TypeError ( 'ERR_MISSING_ARGS' , 'value' ) ;
138
138
139
139
if ( ! value ) {
140
140
if ( message == null ) {
@@ -338,8 +338,8 @@ function expectedException(actual, expected, msg) {
338
338
return expected . test ( actual ) ;
339
339
// assert.doesNotThrow does not accept objects.
340
340
if ( arguments . length === 2 ) {
341
- throw new errors . TypeError ( 'ERR_INVALID_ARG_TYPE' , 'expected' ,
342
- [ 'Function' , 'RegExp' ] , expected ) ;
341
+ throw new TypeError ( 'ERR_INVALID_ARG_TYPE' , 'expected' ,
342
+ [ 'Function' , 'RegExp' ] , expected ) ;
343
343
}
344
344
// The name and message could be non enumerable. Therefore test them
345
345
// explicitly.
@@ -376,8 +376,8 @@ function expectedException(actual, expected, msg) {
376
376
377
377
function getActual ( block ) {
378
378
if ( typeof block !== 'function' ) {
379
- throw new errors . TypeError ( 'ERR_INVALID_ARG_TYPE' , 'block' , 'Function' ,
380
- block ) ;
379
+ throw new TypeError ( 'ERR_INVALID_ARG_TYPE' , 'block' , 'Function' ,
380
+ block ) ;
381
381
}
382
382
try {
383
383
block ( ) ;
@@ -393,10 +393,10 @@ assert.throws = function throws(block, error, message) {
393
393
394
394
if ( typeof error === 'string' ) {
395
395
if ( arguments . length === 3 )
396
- throw new errors . TypeError ( 'ERR_INVALID_ARG_TYPE' ,
397
- 'error' ,
398
- [ 'Function' , 'RegExp' ] ,
399
- error ) ;
396
+ throw new TypeError ( 'ERR_INVALID_ARG_TYPE' ,
397
+ 'error' ,
398
+ [ 'Function' , 'RegExp' ] ,
399
+ error ) ;
400
400
401
401
message = error ;
402
402
error = null ;
@@ -457,7 +457,7 @@ assert.ifError = function ifError(err) {
457
457
message += inspect ( err ) ;
458
458
}
459
459
460
- const newErr = new assert . AssertionError ( {
460
+ const newErr = new AssertionError ( {
461
461
actual : err ,
462
462
expected : null ,
463
463
operator : 'ifError' ,
0 commit comments