From 1b8a3192934b7d3cb70645ab5dadfc2260fed288 Mon Sep 17 00:00:00 2001 From: kobenguyent Date: Wed, 11 Dec 2024 10:16:21 +0100 Subject: [PATCH] fix(cli): missing failure counts when there is failedHooks --- lib/cli.js | 1 - test/runner/before_failure_test.js | 4 ++-- test/runner/run_workers_test.js | 3 ++- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/cli.js b/lib/cli.js index 0d02c7765..410f8f89e 100644 --- a/lib/cli.js +++ b/lib/cli.js @@ -219,7 +219,6 @@ class Cli extends Base { this.failures.forEach((failure) => { if (failure.constructor.name === 'Hook') { - stats.failures -= stats.failures stats.failedHooks += 1 } }) diff --git a/test/runner/before_failure_test.js b/test/runner/before_failure_test.js index 6c54ecb33..6e5912589 100644 --- a/test/runner/before_failure_test.js +++ b/test/runner/before_failure_test.js @@ -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() }) @@ -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() }) diff --git a/test/runner/run_workers_test.js b/test/runner/run_workers_test.js index 7bbfa6b4c..89f121ffd 100644 --- a/test/runner/run_workers_test.js +++ b/test/runner/run_workers_test.js @@ -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