diff --git a/docs/plugins.md b/docs/plugins.md index d7aad9de8..0489bf097 100644 --- a/docs/plugins.md +++ b/docs/plugins.md @@ -815,6 +815,10 @@ Enable it manually on each run via `-p` option: npx codeceptjs run -p pauseOnFail +## reportData + +TypeScript: Explicitly type reportData arrays as any[] to avoid 'never' errors + ## retryFailedStep Retries each failed step in a test. diff --git a/lib/output.js b/lib/output.js index 68567a3be..227a54bf8 100644 --- a/lib/output.js +++ b/lib/output.js @@ -222,12 +222,10 @@ module.exports = { /** * @param {Mocha.Test} test */ - started(test) { if (outputLevel < 1) return print(` ${colors.dim.bold('Scenario()')}`) }, - /** * @param {Mocha.Test} test */ @@ -273,10 +271,12 @@ module.exports = { }, /** + * Prints the stats of a test run to the console. * @param {number} passed * @param {number} failed * @param {number} skipped * @param {number|string} duration + * @param {number} [failedHooks] */ result(passed, failed, skipped, duration, failedHooks = 0) { let style = colors.bgGreen diff --git a/lib/result.js b/lib/result.js index 08e7033b5..2d5ceceaf 100644 --- a/lib/result.js +++ b/lib/result.js @@ -14,6 +14,11 @@ const { serializeTest } = require('./mocha/test') * @property {number} duration Duration of the test run, in milliseconds. */ +/** + * @typedef {Array} Failure + * A detailed formatted report for a failed test. + */ + /** * Result of a test run. Will be emitted for example in "event.all.result" events. */ @@ -48,7 +53,7 @@ class Result { this._tests = [] /** - * @type {string[][]} + * @type {Failure[]} * @private */ this._failures = [] @@ -91,7 +96,7 @@ class Result { /** * The failure reports (array of strings per failed test). * - * @type {string[][]} + * @type {Failure[]} * @readonly */ get failures() { @@ -136,7 +141,7 @@ class Result { /** * Adds failure reports to this result. * - * @param {string[][]} newFailures + * @param {Failure[]} newFailures */ addFailures(newFailures) { this._failures.push(...newFailures)