Skip to content

Commit 6e130ad

Browse files
committed
Do not make tests fail on multipleResolves events with the testing option
1 parent 7226880 commit 6e130ad

File tree

5 files changed

+25
-105
lines changed

5 files changed

+25
-105
lines changed

src/options/runners.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,11 @@ const COMMON_OPTIONS = {
3030
exitOn: [],
3131
// All runners need to report `uncaughtException` for
3232
// `throwUncaughtException()` to work. Most also report `unhandledRejection`.
33-
level: { uncaughtException: 'silent', unhandledRejection: 'silent' },
33+
level: {
34+
uncaughtException: 'silent',
35+
unhandledRejection: 'silent',
36+
multipleResolves: 'silent',
37+
},
3438
}
3539

3640
export const RUNNERS = {

test/options/snapshots/testing.js.md

Lines changed: 20 additions & 104 deletions
Original file line numberDiff line numberDiff line change
@@ -634,41 +634,26 @@ Generated by [AVA](https://ava.li).
634634
> Snapshot 1
635635
636636
{
637-
exitCode: 1,
637+
exitCode: 0,
638638
stderr: '',
639639
stdout: `√ should make tests fail on multipleResolves␊
640640
641-
Uncaught exception in MultipleResolves: a promise was multiple times:␊
642-
Initially resolved with: { success: true }␊
643-
Then rejected with: Error: message␊
644-
645-
× exited with a non-zero exit code: 1␊
646-
647-
1 test passed␊
648-
1 uncaught exception`,
641+
1 test passed`,
649642
}
650643

651644
## should make tests fails | multipleResolves jasmine
652645

653646
> Snapshot 1
654647
655648
{
656-
exitCode: 1,
649+
exitCode: 0,
657650
stderr: '',
658651
stdout: `Randomized with seed 0␊
659652
Started␊
660653
.␊
661654
662655
663-
Suite error: should make tests fail␊
664-
Message:␊
665-
Uncaught exception: MultipleResolves: a promise was multiple times:␊
666-
Initially resolved with: { success: true }␊
667-
Then rejected with: Error: message␊
668-
Stack:␊
669-
at STACK TRACE␊
670-
671-
1 spec, 1 failure␊
656+
1 spec, 0 failures␊
672657
Finished in ␊
673658
Randomized with seed 0 (jasmine --random=true --seed=0)`,
674659
}
@@ -701,44 +686,20 @@ Generated by [AVA](https://ava.li).
701686
> Snapshot 1
702687
703688
{
704-
exitCode: 1,
689+
exitCode: 0,
705690
stderr: '',
706691
stdout: `TAP version 13␊
707-
not ok 1 - # ␊
708-
---␊
709-
env: {}␊
710-
file: timeout: 30000␊
711-
command: args:␊
712-
- -r␊
713-
- - stdio:␊
714-
- 0␊
715-
- pipe␊
716-
- 2␊
717-
cwd: exitCode: 1␊
718-
...␊
719-
{␊
692+
ok 1 - # {␊
720693
# Subtest: should make tests fail on multipleResolves␊
721694
1..1␊
722695
ok 1 - (unnamed test)␊
723696
ok 1 - should make tests fail on multipleResolves # ␊
724697
725-
not ok 2 - a promise was multiple times: Initially resolved with: { success: true } Then rejected with: Error: message␊
726-
---␊
727-
stack: |␊
728-
Then rejected with: Error: message␊
729-
STACK TRACE␊
730-
type: MultipleResolves␊
731-
tapCaught: uncaughtException␊
732-
test: TAP␊
733-
...␊
734-
735-
1..2␊
736-
# failed 1 of 2 tests␊
698+
1..1␊
737699
# ␊
738700
}␊
739701
740702
1..1␊
741-
# failed 1 test␊
742703
# `,
743704
}
744705

@@ -747,23 +708,20 @@ Generated by [AVA](https://ava.li).
747708
> Snapshot 1
748709
749710
{
750-
exitCode: 1,
711+
exitCode: 0,
751712
stderr: '',
752713
stdout: `TAP version 13␊
753-
not ok 1 - # {␊
714+
ok 1 - # {␊
754715
# Subtest: should make tests fail on multipleResolves␊
755716
1..1␊
756717
ok 1 - (unnamed test)␊
757718
ok 1 - should make tests fail on multipleResolves # ␊
758719
759-
not ok 2 - a promise was multiple times: Initially resolved with: { success: true } Then rejected with: Error: message␊
760-
1..2␊
761-
# failed 1 of 2 tests␊
720+
1..1␊
762721
# ␊
763722
}␊
764723
765724
1..1␊
766-
# failed 1 test␊
767725
# `,
768726
}
769727

@@ -1445,41 +1403,26 @@ Generated by [AVA](https://ava.li).
14451403
> Snapshot 1
14461404
14471405
{
1448-
exitCode: 1,
1406+
exitCode: 0,
14491407
stderr: '',
14501408
stdout: `√ should make tests fail on multipleResolves␊
14511409
1452-
Uncaught exception in MultipleResolves: a promise was multiple times:␊
1453-
Initially resolved with: { success: true }␊
1454-
Then rejected with: Error: message␊
1455-
1456-
× exited with a non-zero exit code: 1␊
1457-
1458-
1 test passed␊
1459-
1 uncaught exception`,
1410+
1 test passed`,
14601411
}
14611412

14621413
## should work with the -r flag | multipleResolves jasmine
14631414

14641415
> Snapshot 1
14651416
14661417
{
1467-
exitCode: 1,
1418+
exitCode: 0,
14681419
stderr: '',
14691420
stdout: `Randomized with seed 0␊
14701421
Started␊
14711422
.␊
14721423
14731424
1474-
Suite error: should make tests fail␊
1475-
Message:␊
1476-
Uncaught exception: MultipleResolves: a promise was multiple times:␊
1477-
Initially resolved with: { success: true }␊
1478-
Then rejected with: Error: message␊
1479-
Stack:␊
1480-
at STACK TRACE␊
1481-
1482-
1 spec, 1 failure␊
1425+
1 spec, 0 failures␊
14831426
Finished in ␊
14841427
Randomized with seed 0 (jasmine --random=true --seed=0)`,
14851428
}
@@ -1512,44 +1455,20 @@ Generated by [AVA](https://ava.li).
15121455
> Snapshot 1
15131456
15141457
{
1515-
exitCode: 1,
1458+
exitCode: 0,
15161459
stderr: '',
15171460
stdout: `TAP version 13␊
1518-
not ok 1 - # ␊
1519-
---␊
1520-
env: {}␊
1521-
file: timeout: 30000␊
1522-
command: args:␊
1523-
- -r␊
1524-
- - stdio:␊
1525-
- 0␊
1526-
- pipe␊
1527-
- 2␊
1528-
cwd: exitCode: 1␊
1529-
...␊
1530-
{␊
1461+
ok 1 - # {␊
15311462
# Subtest: should make tests fail on multipleResolves␊
15321463
1..1␊
15331464
ok 1 - (unnamed test)␊
15341465
ok 1 - should make tests fail on multipleResolves # ␊
15351466
1536-
not ok 2 - a promise was multiple times: Initially resolved with: { success: true } Then rejected with: Error: message␊
1537-
---␊
1538-
stack: |␊
1539-
Then rejected with: Error: message␊
1540-
STACK TRACE␊
1541-
type: MultipleResolves␊
1542-
tapCaught: uncaughtException␊
1543-
test: TAP␊
1544-
...␊
1545-
1546-
1..2␊
1547-
# failed 1 of 2 tests␊
1467+
1..1␊
15481468
# ␊
15491469
}␊
15501470
15511471
1..1␊
1552-
# failed 1 test␊
15531472
# `,
15541473
}
15551474

@@ -1558,23 +1477,20 @@ Generated by [AVA](https://ava.li).
15581477
> Snapshot 1
15591478
15601479
{
1561-
exitCode: 1,
1480+
exitCode: 0,
15621481
stderr: '',
15631482
stdout: `TAP version 13␊
1564-
not ok 1 - # {␊
1483+
ok 1 - # {␊
15651484
# Subtest: should make tests fail on multipleResolves␊
15661485
1..1␊
15671486
ok 1 - (unnamed test)␊
15681487
ok 1 - should make tests fail on multipleResolves # ␊
15691488
1570-
not ok 2 - a promise was multiple times: Initially resolved with: { success: true } Then rejected with: Error: message␊
1571-
1..2␊
1572-
# failed 1 of 2 tests␊
1489+
1..1␊
15731490
# ␊
15741491
}␊
15751492
15761493
1..1␊
1577-
# failed 1 test␊
15781494
# `,
15791495
}
15801496

-99 Bytes
Binary file not shown.

test/snapshots/register.js.snap

-4 Bytes
Binary file not shown.

test/snapshots/warnings.js.snap

-5 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)