Skip to content
This repository was archived by the owner on Sep 1, 2024. It is now read-only.

Commit 9cfb501

Browse files
committed
Handle new "focused" test status in Jest 29.4
Jest 29.4 distinguishes between tests that pass when they're the only ones that run and those that pass when all tests run. For Unflakable, both cases are considered test passes (see jestjs/jest#13700).
1 parent 19bb764 commit 9cfb501

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

packages/jest-plugin/src/reporter.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,9 @@ const jestStatusToUnflakableApi = (
6161
return "quarantined";
6262
}
6363

64-
switch (status) {
64+
switch (status as Status | "focused") {
65+
// Introduced in Jest 29.4 (see https://github.com/facebook/jest/pull/13700).
66+
case "focused":
6567
case "passed":
6668
return "pass";
6769
case "failed":
@@ -78,13 +80,15 @@ const getIcon = (test: UnflakableAssertionResult): string => {
7880
if (test._unflakableIsQuarantined === true) {
7981
return chalk.yellow(specialChars.ICONS.failed);
8082
} else {
81-
switch (test.status) {
83+
switch (test.status as Status | "focused") {
8284
case "failed":
8385
return chalk.red(specialChars.ICONS.failed);
8486
case "pending":
8587
return chalk.yellow(specialChars.ICONS.pending);
8688
case "todo":
8789
return chalk.magenta(specialChars.ICONS.todo);
90+
// Introduced in Jest 29.4 (see https://github.com/facebook/jest/pull/13700).
91+
case "focused":
8892
case "passed":
8993
case "skipped":
9094
case "disabled":

0 commit comments

Comments
 (0)