File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed
Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -29,7 +29,7 @@ describe('ErrorWithStack', () => {
2929 } ) ;
3030} ) ;
3131
32- describe ( 'copyStackTrace ' , ( ) => {
32+ describe ( 'copyStackTraceIfNeeded ' , ( ) => {
3333 test ( 'should copy stack trace from source to target when both are Error instances' , ( ) => {
3434 const target = new Error ( 'Target error' ) ;
3535 const source = new Error ( 'Source error' ) ;
@@ -60,8 +60,14 @@ describe('copyStackTrace', () => {
6060
6161 const target = new Error ( 'Target error' ) ;
6262 const originalStack = target . stack ;
63- const sourceNotError = { message : 'Not an error' } ;
6463
64+ copyStackTraceIfNeeded ( target , undefined ) ;
65+ expect ( target . stack ) . toBe ( originalStack ) ;
66+
67+ copyStackTraceIfNeeded ( target , null as unknown as Error ) ;
68+ expect ( target . stack ) . toBe ( originalStack ) ;
69+
70+ const sourceNotError = { message : 'Not an error' } ;
6571 copyStackTraceIfNeeded ( target , sourceNotError as Error ) ;
6672 expect ( target . stack ) . toBe ( originalStack ) ;
6773
You can’t perform that action at this time.
0 commit comments