@@ -10,16 +10,18 @@ const path = require('path');
1010const kArrowMessagePrivateSymbolIndex = binding [ 'arrow_message_private_symbol' ] ;
1111const kDecoratedPrivateSymbolIndex = binding [ 'decorated_private_symbol' ] ;
1212
13+ const decorateErrorStack = internalUtil . decorateErrorStack ;
14+
1315assert . doesNotThrow ( function ( ) {
14- internalUtil . decorateErrorStack ( ) ;
15- internalUtil . decorateErrorStack ( null ) ;
16- internalUtil . decorateErrorStack ( 1 ) ;
17- internalUtil . decorateErrorStack ( true ) ;
16+ decorateErrorStack ( ) ;
17+ decorateErrorStack ( null ) ;
18+ decorateErrorStack ( 1 ) ;
19+ decorateErrorStack ( true ) ;
1820} ) ;
1921
2022// Verify that a stack property is not added to non-Errors
2123const obj = { } ;
22- internalUtil . decorateErrorStack ( obj ) ;
24+ decorateErrorStack ( obj ) ;
2325assert . strictEqual ( obj . stack , undefined ) ;
2426
2527// Verify that the stack is decorated when possible
@@ -43,8 +45,8 @@ assert(typeof err, 'object');
4345checkStack ( err . stack ) ;
4446
4547// Verify that the stack is only decorated once
46- internalUtil . decorateErrorStack ( err ) ;
47- internalUtil . decorateErrorStack ( err ) ;
48+ decorateErrorStack ( err ) ;
49+ decorateErrorStack ( err ) ;
4850checkStack ( err . stack ) ;
4951
5052// Verify that the stack is only decorated once for uncaught exceptions
@@ -58,7 +60,7 @@ checkStack(result.stderr);
5860// Verify that the stack is unchanged when there is no arrow message
5961err = new Error ( 'foo' ) ;
6062let originalStack = err . stack ;
61- internalUtil . decorateErrorStack ( err ) ;
63+ decorateErrorStack ( err ) ;
6264assert . strictEqual ( originalStack , err . stack ) ;
6365
6466// Verify that the arrow message is added to the start of the stack when it
@@ -67,9 +69,9 @@ const arrowMessage = 'arrow_message';
6769err = new Error ( 'foo' ) ;
6870originalStack = err . stack ;
6971
70- internalUtil . setHiddenValue ( err , kArrowMessagePrivateSymbolIndex , arrowMessage ) ;
71- internalUtil . decorateErrorStack ( err ) ;
72+ binding . setHiddenValue ( err , kArrowMessagePrivateSymbolIndex , arrowMessage ) ;
73+ decorateErrorStack ( err ) ;
7274
7375assert . strictEqual ( err . stack , `${ arrowMessage } ${ originalStack } ` ) ;
74- assert . strictEqual ( internalUtil
75- . getHiddenValue ( err , kDecoratedPrivateSymbolIndex ) , true ) ;
76+ assert . strictEqual (
77+ binding . getHiddenValue ( err , kDecoratedPrivateSymbolIndex ) , true ) ;
0 commit comments