@@ -485,24 +485,43 @@ it('Verify node does not support Promise.allSettled stack frames. When this test
485
485
assert . doesNotMatch ( results2 [ 2 ] . reason . stack , / \b P r o m i s e \. a l l S e t t l e d \b / ) ;
486
486
} ) ;
487
487
488
- it ( 'async stack frames: async, Promise.all, Promise.any ' /*Promise.allSettled*/ , async function ( ) {
488
+ it ( 'async stack frames: async, Promise.all' /*Promise.allSettled*/ , async function ( ) {
489
489
await compareStackTrace ( createMultiLineSourceMap ( ) , [
490
490
// Add once node upgrades to v8 10.2, where this was added: https://github.com/v8/v8/commit/89ed081c176e286f9d65f3821d43f568cd56a035
491
491
// 'async function foo() { return await bar(); }',
492
492
// 'async function bar() { return await Promise.allSettled([baz()]) }',
493
493
494
- 'async function foo() { return await baz(); }' ,
495
- 'async function baz() { await Promise.all([biff()]) }' ,
496
- 'async function biff() { await Promise.any([larry()]); }' ,
497
- 'async function larry() { await null; throw new Error("test"); }' ,
494
+ 'async function foo() { return await bar(); }' ,
495
+ 'async function bar() { await Promise.all([baz()]) }' ,
496
+ 'async function baz() { await null; throw new Error("test"); }' ,
497
+ 'return foo();'
498
+ ] , [
499
+ 'Error: test' ,
500
+ re `^ at baz \(${ stackFramePathStartsWith ( ) } (?:.*[/\\])?line3.js:1003:103\)$` ,
501
+ re `^ at async Promise\.all \(index 0\)$` ,
502
+ re `^ at async bar \(${ stackFramePathStartsWith ( ) } (?:.*[/\\])?line2.js:1002:102\)$` ,
503
+ re `^ at async foo \(${ stackFramePathStartsWith ( ) } (?:.*[/\\])?line1.js:1001:101\)$`
504
+ ] ) ;
505
+ } ) ;
506
+
507
+ it ( 'async stack frames: Promise.any' , async function ( ) {
508
+ // node 14 and older does not have Promise.any
509
+ if ( semver . lt ( process . versions . node , '16.0.0' ) ) return this . skip ( ) ;
510
+
511
+ await compareStackTrace ( createMultiLineSourceMap ( ) , [
512
+ // Add once node upgrades to v8 10.2, where this was added: https://github.com/v8/v8/commit/89ed081c176e286f9d65f3821d43f568cd56a035
513
+ // 'async function foo() { return await bar(); }',
514
+ // 'async function bar() { return await Promise.allSettled([baz()]) }',
515
+
516
+ 'async function foo() { return await bar(); }' ,
517
+ 'async function bar() { await Promise.any([baz()]); }' ,
518
+ 'async function baz() { await null; throw new Error("test"); }' ,
498
519
'return foo().catch(e => { throw e.errors[0] })'
499
520
] , [
500
521
'Error: test' ,
501
- re `^ at larry \(${ stackFramePathStartsWith ( ) } (?:.*[/\\])?line4 .js:1004:104 \)$` ,
522
+ re `^ at baz \(${ stackFramePathStartsWith ( ) } (?:.*[/\\])?line3 .js:1003:103 \)$` ,
502
523
re `^ at async Promise\.any \(index 0\)$` ,
503
- re `^ at async biff \(${ stackFramePathStartsWith ( ) } (?:.*[/\\])?line3.js:1003:103\)$` ,
504
- re `^ at async Promise\.all \(index 0\)$` ,
505
- re `^ at async baz \(${ stackFramePathStartsWith ( ) } (?:.*[/\\])?line2.js:1002:102\)$` ,
524
+ re `^ at async bar \(${ stackFramePathStartsWith ( ) } (?:.*[/\\])?line2.js:1002:102\)$` ,
506
525
re `^ at async foo \(${ stackFramePathStartsWith ( ) } (?:.*[/\\])?line1.js:1001:101\)$`
507
526
] ) ;
508
527
} ) ;
0 commit comments