Skip to content

Commit e5c5a9b

Browse files
authored
fixed jest finalStatus tag test suite (#7904)
1 parent 87051d8 commit e5c5a9b

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

integration-tests/jest/jest.spec.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2535,7 +2535,7 @@ describe(`jest@${JEST_VERSION} commonJS`, () => {
25352535
assert.strictEqual(tests.length, 3)
25362536

25372537
// Only the last execution (the one with status 'pass') should have TEST_FINAL_STATUS tag
2538-
tests.sort((a, b) => a.meta.start - b.meta.start).forEach((test, idx) => {
2538+
tests.sort((a, b) => (a.start < b.start ? -1 : a.start > b.start ? 1 : 0)).forEach((test, idx) => {
25392539
if (idx < tests.length - 1) {
25402540
assert.ok(!(TEST_FINAL_STATUS in test.meta),
25412541
'TEST_FINAL_STATUS should not be set on previous runs'
@@ -2602,7 +2602,7 @@ describe(`jest@${JEST_VERSION} commonJS`, () => {
26022602
const newTests = tests.filter(test =>
26032603
test.meta[TEST_SUITE] === 'ci-visibility/test/ci-visibility-test-2.js'
26042604
)
2605-
newTests.sort((a, b) => a.meta.start - b.meta.start).forEach((test, index) => {
2605+
newTests.sort((a, b) => (a.start < b.start ? -1 : a.start > b.start ? 1 : 0)).forEach((test, index) => {
26062606
if (index < newTests.length - 1) {
26072607
assert.ok(!(TEST_FINAL_STATUS in test.meta))
26082608
} else {
@@ -4259,7 +4259,8 @@ describe(`jest@${JEST_VERSION} commonJS`, () => {
42594259
test => test.resource ===
42604260
'ci-visibility/jest-flaky/flaky-passes.js.test-flaky-test-retries can retry flaky tests'
42614261
)
4262-
eventuallyPassingTest.sort((a, b) => a.meta.start - b.meta.start).forEach((test, index) => {
4262+
eventuallyPassingTest.sort((a, b) =>
4263+
(a.start < b.start ? -1 : a.start > b.start ? 1 : 0)).forEach((test, index) => {
42634264
if (index < eventuallyPassingTest.length - 1) {
42644265
assert.ok(!(TEST_FINAL_STATUS in test.meta))
42654266
} else {
@@ -4272,7 +4273,8 @@ describe(`jest@${JEST_VERSION} commonJS`, () => {
42724273
test => test.resource ===
42734274
'ci-visibility/jest-flaky/flaky-fails.js.test-flaky-test-retries can retry failed tests'
42744275
)
4275-
neverPassingTest.sort((a, b) => a.meta.start - b.meta.start).forEach((test, index) => {
4276+
neverPassingTest.sort((a, b) =>
4277+
(a.start < b.start ? -1 : a.start > b.start ? 1 : 0)).forEach((test, index) => {
42764278
if (index < neverPassingTest.length - 1) {
42774279
assert.ok(!(TEST_FINAL_STATUS in test.meta))
42784280
} else {

0 commit comments

Comments
 (0)