Skip to content

Commit 39ae05a

Browse files
[test optimization] Fix jest test assertion (#7774)
Resolves the TODO at jest.spec.js:2933 — verify that when a new test retried by Early Flake Detection fails some attempts, the process exit code remains 0. Also converts the test from done-callback to async/await style. Co-authored-by: Claude Opus 4.6 (1M context) <[email protected]>
1 parent c8ff80a commit 39ae05a

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

integration-tests/jest/jest.spec.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2877,7 +2877,7 @@ describe(`jest@${JEST_VERSION} commonJS`, () => {
28772877
})
28782878
})
28792879

2880-
it('retries flaky tests', (done) => {
2880+
it('retries flaky tests', async () => {
28812881
receiver.setInfoResponse({ endpoints: ['/evp_proxy/v4'] })
28822882
// Tests from ci-visibility/test/occasionally-failing-test will be considered new
28832883
receiver.setKnownTests({ jest: {} })
@@ -2929,12 +2929,12 @@ describe(`jest@${JEST_VERSION} commonJS`, () => {
29292929
},
29302930
}
29312931
)
2932-
childProcess.on('exit', () => {
2933-
// TODO: check exit code: if a new, retried test fails, the exit code should remain 0
2934-
eventsPromise.then(() => {
2935-
done()
2936-
}).catch(done)
2937-
})
2932+
2933+
const [[exitCode]] = await Promise.all([
2934+
once(childProcess, 'exit'),
2935+
eventsPromise,
2936+
])
2937+
assert.strictEqual(exitCode, 0)
29382938
})
29392939

29402940
it('does not retry new tests that are skipped', (done) => {

0 commit comments

Comments
 (0)