Skip to content

Commit 886bbe7

Browse files
committed
fixed minor TS typing issues in class Result and output.result
1 parent 1584113 commit 886bbe7

File tree

3 files changed

+14
-5
lines changed

3 files changed

+14
-5
lines changed

docs/plugins.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -815,6 +815,10 @@ Enable it manually on each run via `-p` option:
815815
816816
npx codeceptjs run -p pauseOnFail
817817
818+
## reportData
819+
820+
TypeScript: Explicitly type reportData arrays as any\[] to avoid 'never' errors
821+
818822
## retryFailedStep
819823
820824
Retries each failed step in a test.

lib/output.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -222,12 +222,10 @@ module.exports = {
222222
/**
223223
* @param {Mocha.Test} test
224224
*/
225-
226225
started(test) {
227226
if (outputLevel < 1) return
228227
print(` ${colors.dim.bold('Scenario()')}`)
229228
},
230-
231229
/**
232230
* @param {Mocha.Test} test
233231
*/
@@ -273,10 +271,12 @@ module.exports = {
273271
},
274272

275273
/**
274+
* Prints the stats of a test run to the console.
276275
* @param {number} passed
277276
* @param {number} failed
278277
* @param {number} skipped
279278
* @param {number|string} duration
279+
* @param {number} [failedHooks]
280280
*/
281281
result(passed, failed, skipped, duration, failedHooks = 0) {
282282
let style = colors.bgGreen

lib/result.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,11 @@ const { serializeTest } = require('./mocha/test')
1414
* @property {number} duration Duration of the test run, in milliseconds.
1515
*/
1616

17+
/**
18+
* @typedef {Array<string|number>} Failure
19+
* A detailed formatted report for a failed test.
20+
*/
21+
1722
/**
1823
* Result of a test run. Will be emitted for example in "event.all.result" events.
1924
*/
@@ -48,7 +53,7 @@ class Result {
4853
this._tests = []
4954

5055
/**
51-
* @type {string[][]}
56+
* @type {Failure[]}
5257
* @private
5358
*/
5459
this._failures = []
@@ -91,7 +96,7 @@ class Result {
9196
/**
9297
* The failure reports (array of strings per failed test).
9398
*
94-
* @type {string[][]}
99+
* @type {Failure[]}
95100
* @readonly
96101
*/
97102
get failures() {
@@ -136,7 +141,7 @@ class Result {
136141
/**
137142
* Adds failure reports to this result.
138143
*
139-
* @param {string[][]} newFailures
144+
* @param {Failure[]} newFailures
140145
*/
141146
addFailures(newFailures) {
142147
this._failures.push(...newFailures)

0 commit comments

Comments
 (0)