@@ -4,7 +4,6 @@ const { mustCall, hasCrypto } = require('../common');
44const assert = require ( 'assert' ) ;
55const util = require ( 'util' ) ;
66const { test } = require ( 'node:test' ) ;
7- const { AssertionError } = assert ;
87const defaultMsgStart = 'Expected values to be strictly deep-equal:\n' ;
98const defaultMsgStartFull = `${ defaultMsgStart } + actual - expected` ;
109
@@ -688,11 +687,11 @@ test('Handle sparse arrays', () => {
688687 const b = new Array ( 3 ) ;
689688 a [ 2 ] = true ;
690689 b [ 1 ] = true ;
691- assertNotDeepOrStrict ( a , b , AssertionError , { partial : 'pass' } ) ;
690+ assertNotDeepOrStrict ( a , b , assert . AssertionError , { partial : 'pass' } ) ;
692691 b [ 2 ] = true ;
693692 assertNotDeepOrStrict ( a , b ) ;
694693 a [ 0 ] = true ;
695- assertNotDeepOrStrict ( a , b , AssertionError , { partial : 'pass' } ) ;
694+ assertNotDeepOrStrict ( a , b , assert . AssertionError , { partial : 'pass' } ) ;
696695} ) ;
697696
698697test ( 'Handle sets and maps with mixed keys' , ( ) => {
@@ -715,7 +714,7 @@ test('Handle different error messages', () => {
715714 assertNotDeepOrStrict ( err1 , new Error ( 'foo2' ) , assert . AssertionError ) ;
716715 assertNotDeepOrStrict ( err1 , new TypeError ( 'foo1' ) , assert . AssertionError ) ;
717716 assertDeepAndStrictEqual ( err1 , new Error ( 'foo1' ) ) ;
718- assertNotDeepOrStrict ( err1 , { } , AssertionError ) ;
717+ assertNotDeepOrStrict ( err1 , { } , assert . AssertionError ) ;
719718} ) ;
720719
721720test ( 'Handle NaN' , ( ) => {
@@ -811,18 +810,18 @@ test('Additional tests', () => {
811810 assertDeepAndStrictEqual ( new Date ( 2000 , 3 , 14 ) , new Date ( 2000 , 3 , 14 ) ) ;
812811
813812 assert . throws ( ( ) => { assert . deepEqual ( new Date ( ) , new Date ( 2000 , 3 , 14 ) ) ; } ,
814- AssertionError ,
813+ assert . AssertionError ,
815814 'deepEqual(new Date(), new Date(2000, 3, 14))' ) ;
816815
817816 assert . throws (
818817 ( ) => { assert . notDeepEqual ( new Date ( 2000 , 3 , 14 ) , new Date ( 2000 , 3 , 14 ) ) ; } ,
819- AssertionError ,
818+ assert . AssertionError ,
820819 'notDeepEqual(new Date(2000, 3, 14), new Date(2000, 3, 14))'
821820 ) ;
822821
823822 assert . throws (
824823 ( ) => { assert . notDeepEqual ( 'a' . repeat ( 1024 ) , 'a' . repeat ( 1024 ) ) ; } ,
825- AssertionError ,
824+ assert . AssertionError ,
826825 'notDeepEqual("a".repeat(1024), "a".repeat(1024))'
827826 ) ;
828827
@@ -861,7 +860,7 @@ test('Additional tests', () => {
861860 assert . deepEqual ( 4 , '4' ) ;
862861 assert . deepEqual ( true , 1 ) ;
863862 assert . throws ( ( ) => assert . deepEqual ( 4 , '5' ) ,
864- AssertionError ,
863+ assert . AssertionError ,
865864 'deepEqual( 4, \'5\')' ) ;
866865} ) ;
867866
@@ -870,7 +869,7 @@ test('Having the same number of owned properties && the same set of keys', () =>
870869 assert . deepEqual ( { a : 4 , b : '2' } , { a : 4 , b : '2' } ) ;
871870 assert . deepEqual ( [ 4 ] , [ '4' ] ) ;
872871 assert . throws (
873- ( ) => assert . deepEqual ( { a : 4 } , { a : 4 , b : true } ) , AssertionError ) ;
872+ ( ) => assert . deepEqual ( { a : 4 } , { a : 4 , b : true } ) , assert . AssertionError ) ;
874873 assert . notDeepEqual ( [ 'a' ] , { 0 : 'a' } ) ;
875874 assert . deepEqual ( { a : 4 , b : '1' } , { b : '1' , a : 4 } ) ;
876875 const a1 = [ 1 , 2 , 3 ] ;
@@ -880,7 +879,7 @@ test('Having the same number of owned properties && the same set of keys', () =>
880879 a2 . b = true ;
881880 a2 . a = 'test' ;
882881 assert . throws ( ( ) => assert . deepEqual ( Object . keys ( a1 ) , Object . keys ( a2 ) ) ,
883- AssertionError ) ;
882+ assert . AssertionError ) ;
884883 assertDeepAndStrictEqual ( a1 , a2 ) ;
885884} ) ;
886885
@@ -946,7 +945,7 @@ test('Additional tests', () => {
946945
947946 assert . throws (
948947 ( ) => assert . deepStrictEqual ( new Date ( ) , new Date ( 2000 , 3 , 14 ) ) ,
949- AssertionError ,
948+ assert . AssertionError ,
950949 'deepStrictEqual(new Date(), new Date(2000, 3, 14))'
951950 ) ;
952951
@@ -1059,7 +1058,7 @@ test('Additional tests', () => {
10591058
10601059 assert . throws (
10611060 ( ) => assert . deepStrictEqual ( [ 0 , 1 , 2 , 'a' , 'b' ] , [ 0 , 1 , 2 , 'b' , 'a' ] ) ,
1062- AssertionError ) ;
1061+ assert . AssertionError ) ;
10631062} ) ;
10641063
10651064test ( 'Having the same number of owned properties && the same set of keys' , ( ) => {
@@ -1105,7 +1104,7 @@ test('Prototype check', () => {
11051104 const obj1 = new Constructor1 ( 'Ryan' , 'Dahl' ) ;
11061105 let obj2 = new Constructor2 ( 'Ryan' , 'Dahl' ) ;
11071106
1108- assert . throws ( ( ) => assert . deepStrictEqual ( obj1 , obj2 ) , AssertionError ) ;
1107+ assert . throws ( ( ) => assert . deepStrictEqual ( obj1 , obj2 ) , assert . AssertionError ) ;
11091108
11101109 Constructor2 . prototype = Constructor1 . prototype ;
11111110 obj2 = new Constructor2 ( 'Ryan' , 'Dahl' ) ;
@@ -1262,7 +1261,7 @@ test('Verify that changed tags will still check for the error message', () => {
12621261 err [ Symbol . toStringTag ] = 'Foobar' ;
12631262 const err2 = new Error ( 'bar' ) ;
12641263 err2 [ Symbol . toStringTag ] = 'Foobar' ;
1265- assertNotDeepOrStrict ( err , err2 , AssertionError ) ;
1264+ assertNotDeepOrStrict ( err , err2 , assert . AssertionError ) ;
12661265} ) ;
12671266
12681267test ( 'Check for non-native errors' , ( ) => {
@@ -1281,8 +1280,8 @@ test('Check for non-native errors', () => {
12811280test ( 'Check for Errors with cause property' , ( ) => {
12821281 const e1 = new Error ( 'err' , { cause : new Error ( 'cause e1' ) } ) ;
12831282 const e2 = new Error ( 'err' , { cause : new Error ( 'cause e2' ) } ) ;
1284- assertNotDeepOrStrict ( e1 , e2 , AssertionError ) ;
1285- assertNotDeepOrStrict ( e1 , new Error ( 'err' ) , AssertionError ) ;
1283+ assertNotDeepOrStrict ( e1 , e2 , assert . AssertionError ) ;
1284+ assertNotDeepOrStrict ( e1 , new Error ( 'err' ) , assert . AssertionError ) ;
12861285 assertDeepAndStrictEqual ( e1 , new Error ( 'err' , { cause : new Error ( 'cause e1' ) } ) ) ;
12871286} ) ;
12881287
@@ -1294,8 +1293,8 @@ test('Check for AggregateError', () => {
12941293 const e3 = new AggregateError ( [ e1duplicate , e2 ] , 'Aggregate Error' ) ;
12951294 const e3duplicate = new AggregateError ( [ e1 , e2 ] , 'Aggregate Error' ) ;
12961295 const e4 = new AggregateError ( [ e1 ] , 'Aggregate Error' ) ;
1297- assertNotDeepOrStrict ( e1 , e3 , AssertionError ) ;
1298- assertNotDeepOrStrict ( e3 , e4 , AssertionError ) ;
1296+ assertNotDeepOrStrict ( e1 , e3 , assert . AssertionError ) ;
1297+ assertNotDeepOrStrict ( e3 , e4 , assert . AssertionError ) ;
12991298 assertDeepAndStrictEqual ( e3 , e3duplicate ) ;
13001299} ) ;
13011300
0 commit comments