CodeceptJS icon indicating copy to clipboard operation
CodeceptJS copied to clipboard

run-workers exits successfully despite test failures when using mocha-junit-reporter

Open examosa opened this issue 3 years ago • 3 comments

Expected

Using the run-workers subcommand will return a non-zero exit code if any tests fail, regardless of reporter used.

Actual

run-workers exits with code 0 even if there are test failures when using mocha-junit-reporter

Console Output

yarn run v1.22.18
$ codeceptjs run-workers --suites 8 --reporter mocha-junit-reporter
CodeceptJS v3.3.0
Running tests in 8 workers...

context
[01]   ✔ Log in as an Administrator in 15873ms
[01]   ✖ Log in as a regular User in 22165ms

  OK  | 0 passed   // 44s
✨  Done in 46.36s.

Process finished with exit code 0

Details

  • CodeceptJS version: 3.3.0
  • NodeJS Version: 16.14.2
  • Operating System: macOS Monterey 12.3.1
  • Configuration file:
const { register } = require('ts-node')
const { setBrowser, setCommonPlugins, setHeadlessWhen, setTestHost } = require('@codeceptjs/configure')

register({
  projectSearchDir: 'tests'
})

const { users } = require('./tests/config/plugins/autoLogin.ts')

const productionHost = 'https://example.com'

setBrowser(process.env.BROWSER ?? 'chromium')
setHeadlessWhen(process.env.HEADLESS)
setTestHost(process.env.TESTHOST ?? productionHost)
setCommonPlugins()

exports.config = {
  name: 'ui-tests',
  tests: 'tests/ui/**/*.test.ts',
  output: 'tests/output',
  helpers: {
    Playwright: {
      show: true,
      waitForTimeout: 15_000
    }
  },
  plugins: {
    retryFailedStep: {
      enabled: true
    },
    autoLogin: {
      enabled: true,
      inject: 'loginAs',
      users
    }
  },
  mocha: {
    reporterOptions: {
      stdout: 'tests/output/console.log',
      mochaFile: 'tests/output/test-results.xml',
      'mocha-junit-reporter': {
        options: {
          attachments: true
        }
      }
    }
  }
}

examosa avatar Apr 25 '22 17:04 examosa

This issue is stale because it has been open for 90 days with no activity.

github-actions[bot] avatar Dec 14 '23 02:12 github-actions[bot]

Same issue here. npx codeceptjs run-workers 3 If some tests failed, Im getting this:

[02]   ✖ Тестирование логина и логаута @smoke @C8 in 8302ms
[01]   ✔ Переход в профайл игрока заполнение данных для игрока с регистрацией через телефон @smoke @C27 in 61651ms
[01]   ✔ История выводов @smoke @C16 in 5920ms
  OK  | 0 passed   // 6m
$ echo $?
0

Gitlab runner: green but should be red.

exotlv avatar Dec 27 '23 14:12 exotlv

This issue is stale because it has been open for 90 days with no activity.

github-actions[bot] avatar Mar 28 '24 02:03 github-actions[bot]