diff --git a/packages/mocha/index.js b/packages/mocha/index.js index 338caac..2906834 100644 --- a/packages/mocha/index.js +++ b/packages/mocha/index.js @@ -145,6 +145,10 @@ class Runner extends EventEmitter { this.emit(EVENT_RUN_BEGIN); } + get suite() { + return this.#current; + } + end() { if (!this.#reporter) { return; diff --git a/packages/mocha/tests/customReporter/reporter.js b/packages/mocha/tests/customReporter/reporter.js index b9eef69..9a10c33 100644 --- a/packages/mocha/tests/customReporter/reporter.js +++ b/packages/mocha/tests/customReporter/reporter.js @@ -2,8 +2,11 @@ 'use strict'; +const assert = require('assert'); + class Reporter { constructor(runner) { + assert(runner.suite, 'missing root suite'); runner.on('test end', (test) => { console.log({ state: test.state,