From d9260a9561fc1511a7f2450420f4217c57ceaf78 Mon Sep 17 00:00:00 2001 From: Moshe Atlow Date: Thu, 14 Mar 2024 16:12:35 +0200 Subject: [PATCH] fix: mochaawsome broken --- packages/mocha/index.js | 4 ++++ packages/mocha/tests/customReporter/reporter.js | 3 +++ 2 files changed, 7 insertions(+) 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,