@@ -284,7 +284,9 @@ testShortAssertionMessage(Infinity, 'Infinity');
284284testShortAssertionMessage ( 'a' , '"a"' ) ;
285285testShortAssertionMessage ( 'foo' , '\'foo\'' ) ;
286286testShortAssertionMessage ( 0 , '0' ) ;
287- testShortAssertionMessage ( Symbol ( ) , 'Symbol()' ) ;
287+ if ( common . symbolSupported ) {
288+ testShortAssertionMessage ( Symbol ( ) , 'Symbol()' ) ;
289+ }
288290testAssertionMessage ( [ ] , '[]' ) ;
289291testAssertionMessage ( / a / , '/a/' ) ;
290292testAssertionMessage ( / a b c / gim, '/abc/gim' ) ;
@@ -400,7 +402,7 @@ assert.throws(() => {
400402 // `+ '${'A'.repeat(1000)}'\n- ''`
401403} ) ;
402404
403- {
405+ if ( common . symbolSupported ) {
404406 // Bad args to AssertionError constructor should throw TypeError.
405407 const args = [ 1 , true , false , '' , null , Infinity , Symbol ( 'test' ) , undefined ] ;
406408 args . forEach ( ( input ) => {
@@ -662,15 +664,17 @@ common.expectsError(
662664 }
663665) ;
664666
665- common . expectsError (
666- ( ) => assert ( false , Symbol ( 'foo' ) ) ,
667- {
668- code : 'ERR_ASSERTION' ,
669- // type: assert.AssertionError,
670- generatedMessage : false ,
671- // message: 'Symbol(foo)'
672- }
673- ) ;
667+ if ( common . symbolSupported ) {
668+ common . expectsError (
669+ ( ) => assert ( false , Symbol ( 'foo' ) ) ,
670+ {
671+ code : 'ERR_ASSERTION' ,
672+ // type: assert.AssertionError,
673+ generatedMessage : false ,
674+ // message: 'Symbol(foo)'
675+ }
676+ ) ;
677+ }
674678
675679// [browserify]
676680// This test uses internal Node.js functionality so we have to skip it.
@@ -862,20 +866,22 @@ common.expectsError(
862866 }
863867) ;
864868
865- [
866- 1 ,
867- false ,
868- Symbol ( )
869- ] . forEach ( ( input ) => {
870- assert . throws (
871- ( ) => assert . throws ( ( ) => { } , input ) ,
872- {
873- code : 'ERR_INVALID_ARG_TYPE' ,
874- // message: 'The "error" argument must be one of type Object, Error, ' +
875- // `Function, or RegExp. Received type ${typeof input}`
876- }
877- ) ;
878- } ) ;
869+ if ( common . symbolSupported ) {
870+ [
871+ 1 ,
872+ false ,
873+ Symbol ( )
874+ ] . forEach ( ( input ) => {
875+ assert . throws (
876+ ( ) => assert . throws ( ( ) => { } , input ) ,
877+ {
878+ code : 'ERR_INVALID_ARG_TYPE' ,
879+ // message: 'The "error" argument must be one of type Object, Error, ' +
880+ // `Function, or RegExp. Received type ${typeof input}`
881+ }
882+ ) ;
883+ } ) ;
884+ }
879885
880886{
881887
@@ -1199,10 +1205,12 @@ assert.throws(
11991205 { code : 'ERR_MISSING_ARGS' }
12001206) ;
12011207
1202- assert . throws (
1203- ( ) => a . deepStrictEqual ( Symbol ( ) ) ,
1204- { code : 'ERR_MISSING_ARGS' }
1205- ) ;
1208+ if ( common . symbolSupported ) {
1209+ assert . throws (
1210+ ( ) => a . deepStrictEqual ( Symbol ( ) ) ,
1211+ { code : 'ERR_MISSING_ARGS' }
1212+ ) ;
1213+ }
12061214
12071215if ( common . bigIntSupported ) {
12081216 assert . throws (
0 commit comments