Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion lib/rerun.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,8 @@ class CodeceptRerunner extends BaseCodecept {
output.error(e.stack)
throw e
} finally {
event.emit(event.all.result, this)
// Ensure we emit the correct result object for listeners
event.emit(event.all.result, container.result())
event.emit(event.all.after, this)
}
}
Expand Down
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -84,16 +84,16 @@
"acorn": "8.15.0",
"arrify": "3.0.0",
"axios": "1.12.2",
"chalk": "4.1.2",
"chalk": "^4.1.2",
"cheerio": "^1.0.0",
"chokidar": "^4.0.3",
"commander": "11.1.0",
"commander": "^11.1.0",
"cross-spawn": "7.0.6",
"css-to-xpath": "0.1.0",
"csstoxpath": "1.6.0",
"envinfo": "7.14.0",
"escape-string-regexp": "4.0.0",
"figures": "3.2.0",
"figures": "^3.2.0",
"fn-args": "4.0.0",
"fs-extra": "11.3.2",
"fuse.js": "^7.0.0",
Expand All @@ -107,9 +107,9 @@
"lodash.merge": "4.6.2",
"lodash.shuffle": "4.2.0",
"mkdirp": "3.0.1",
"mocha": "11.7.2",
"mocha": "^11.7.2",
"monocart-coverage-reports": "2.12.9",
"ms": "2.1.3",
"ms": "^2.1.3",
"multer": "^2.0.2",
"ora-classic": "5.4.2",
"parse-function": "5.6.10",
Expand Down
17 changes: 17 additions & 0 deletions test/runner/run_rerun_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,23 @@ describe('run-rerun command', () => {
})
})

it('should emit correct result object and not show OK when tests fail', done => {
exec(`${codecept_run_config('codecept.conf.fail_test.js', '@RunRerun - Fail all attempt')}`, (err, stdout) => {
// Should show individual run failures correctly
expect(stdout).toContain('FAIL |')
expect(stdout).toContain('failed')

// Should not show "OK | 0 passed" when tests actually failed
expect(stdout).not.toContain('OK | 0 passed')

// Should show the expected error message for flaky tests
expect(stdout).toContain('Flaky tests detected!')

expect(err.code).toBe(1)
done()
})
})

it('should display success run if test was fail one time of two attempts and 3 reruns', done => {
exec(`FAIL_ATTEMPT=0 ${codecept_run_config('codecept.conf.fail_test.js', '@RunRerun - fail second test')} --debug`, (err, stdout) => {
expect(stdout).toContain('Process run 1 of max 3, success runs 1/2')
Expand Down