You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When an error is thrown inside an After or AfterSuite hook in CodeceptJS, the process should exit with a non-zero exit code (e.g. 1), indicating failure.
What do you get instead?
Process exits with code 0, indicating success. This misleads CI systems and users, as the test run should be considered failed when any lifecycle hook fails. This worked correctly in CodeceptJS 3.6.6.
It also works correctly for Before and BeforeSuite hooks.
Reproduction steps
Feature('after-hook');
Before(({ I }) => {
I.amOnPage('https://www.google.com')
I.waitForText('Google')
})
After(({ I }) => {
I.waitForText('Google-xxx-FAIL') // This will fail
})
Scenario('test something', ({ I }) => {
I.waitForText('Google')
})
To obtain exit code, you can run with npm run codeceptjs; echo "Exit code: $?"