Skip to content

Commit

Permalink
fix(cli): missing failure counts when there is failedHooks
Browse files Browse the repository at this point in the history
  • Loading branch information
kobenguyent committed Dec 11, 2024
1 parent 831f13e commit 1b8a319
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
1 change: 0 additions & 1 deletion lib/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,6 @@ class Cli extends Base {

this.failures.forEach((failure) => {
if (failure.constructor.name === 'Hook') {
stats.failures -= stats.failures
stats.failedHooks += 1
}
})
Expand Down
4 changes: 2 additions & 2 deletions test/runner/before_failure_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ describe('Failure in before', function () {
stdout.should.include('First test will be passed @grep')
stdout.should.include('Third test will be skipped @grep')
stdout.should.include('Fourth test will be skipped')
stdout.should.include('1 passed, 1 failedHooks, 2 skipped')
stdout.should.include('1 passed, 1 failed, 1 failedHooks, 2 skipped')
err.code.should.eql(1)
done()
})
Expand All @@ -22,7 +22,7 @@ describe('Failure in before', function () {
exec(`${codecept_run} --grep @grep`, (err, stdout) => {
stdout.should.include('First test will be passed @grep')
stdout.should.include('Third test will be skipped @grep')
stdout.should.include('1 passed, 1 failedHooks, 1 skipped')
stdout.should.include('1 passed, 1 failed, 1 failedHooks, 1 skipped')
err.code.should.eql(1)
done()
})
Expand Down
3 changes: 2 additions & 1 deletion test/runner/run_workers_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ describe('CodeceptJS Workers Runner', function () {
expect(stdout).not.toContain('this is running inside worker')
expect(stdout).toContain('failed')
expect(stdout).toContain('File notafile not found')
expect(stdout).toContain('5 passed, 1 failed, 1 failedHooks')
expect(stdout).toContain('Scenario Steps:')
expect(stdout).toContain('5 passed, 2 failed, 1 failedHooks')
// We are not testing order in logs, because it depends on race condition between workers
expect(stdout).toContain(') Workers Failing\n') // first fail log
expect(stdout).toContain(') Workers\n') // second fail log
Expand Down

0 comments on commit 1b8a319

Please sign in to comment.