(runner, opts)
| 33 | |
| 34 | class Cli extends Base { |
| 35 | constructor(runner, opts) { |
| 36 | super(runner) |
| 37 | let level = 0 |
| 38 | this.loadedTests = [] |
| 39 | opts = opts.reporterOptions || opts |
| 40 | if (opts.steps) level = 1 |
| 41 | if (opts.debug) level = 2 |
| 42 | if (opts.verbose) level = 3 |
| 43 | output.level(level) |
| 44 | output.print(`CodeceptJS v${codeceptVersion} ${output.standWithUkraine()}`) |
| 45 | output.print(`Using test root "${store.codeceptDir}"`) |
| 46 | |
| 47 | const showSteps = level >= 1 |
| 48 | |
| 49 | if (level >= 2) { |
| 50 | // Load container asynchronously to avoid circular dependency |
| 51 | getContainer().then(Container => { |
| 52 | output.print(output.styles.debug(`Helpers: ${Object.keys(Container.helpers()).join(', ')}`)) |
| 53 | output.print(output.styles.debug(`Plugins: ${Object.keys(Container.plugins()).join(', ')}`)) |
| 54 | }).catch(() => { |
| 55 | // Silently fail if container can't be loaded |
| 56 | output.print(output.styles.debug('Helpers: [loading...]')) |
| 57 | output.print(output.styles.debug('Plugins: [loading...]')) |
| 58 | }) |
| 59 | } |
| 60 | |
| 61 | if (level >= 3) { |
| 62 | process.on('warning', warning => { |
| 63 | console.log('\nWarning Details:') |
| 64 | console.log('Name:', warning.name) |
| 65 | console.log('Message:', warning.message) |
| 66 | console.log('Stack:', warning.stack) |
| 67 | console.log('-------------------') |
| 68 | }) |
| 69 | } |
| 70 | |
| 71 | runner.on('start', () => { |
| 72 | console.log() |
| 73 | }) |
| 74 | |
| 75 | runner.on('suite', suite => { |
| 76 | output.suite.started(suite) |
| 77 | }) |
| 78 | |
| 79 | runner.on('fail', test => { |
| 80 | if (test.ctx.currentTest) { |
| 81 | this.loadedTests.push(test.ctx.currentTest.uid) |
| 82 | } |
| 83 | if (showSteps && test.steps) { |
| 84 | return output.scenario.failed(test) |
| 85 | } |
| 86 | cursor.CR() |
| 87 | output.test.failed(test) |
| 88 | }) |
| 89 | |
| 90 | runner.on('pending', test => { |
| 91 | if (test.parent && test.parent.pending) { |
| 92 | const suite = test.parent |
nothing calls this directly
no test coverage detected