From 886bbe77dff48c40d62615df27fc6c7afdb4d844 Mon Sep 17 00:00:00 2001 From: Daniel Rentz Date: Mon, 6 Oct 2025 09:43:04 +0200 Subject: [PATCH 1/2] fixed minor TS typing issues in class Result and output.result --- docs/plugins.md | 4 ++++ lib/output.js | 4 ++-- lib/result.js | 11 ++++++++--- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/docs/plugins.md b/docs/plugins.md index d7aad9de8..19b335ada 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) From ebe54ad43011b1ccd6cb958c0f13f0b1912355cf Mon Sep 17 00:00:00 2001 From: Daniel Rentz Date: Fri, 31 Oct 2025 00:03:08 +0100 Subject: [PATCH 2/2] remove backslash --- docs/plugins.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/plugins.md b/docs/plugins.md index 19b335ada..0489bf097 100644 --- a/docs/plugins.md +++ b/docs/plugins.md @@ -817,7 +817,7 @@ Enable it manually on each run via `-p` option: ## reportData -TypeScript: Explicitly type reportData arrays as any\[] to avoid 'never' errors +TypeScript: Explicitly type reportData arrays as any[] to avoid 'never' errors ## retryFailedStep