Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: mochaawsome broken #122

Merged
merged 1 commit into from
Mar 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions packages/mocha/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -134,17 +134,21 @@
try {
Reporter = await import(reporterName).then((m) => m.default || m);
} catch (err) {
console.error(err);

Check warning on line 137 in packages/mocha/index.js

View workflow job for this annotation

GitHub Actions / tests (v18)

Unexpected console statement

Check warning on line 137 in packages/mocha/index.js

View workflow job for this annotation

GitHub Actions / tests (v20)

Unexpected console statement

Check warning on line 137 in packages/mocha/index.js

View workflow job for this annotation

GitHub Actions / tests (v21)

Unexpected console statement
}
}
if (!Reporter) {
console.error(new Error(`invalid reporter "${reporterName}"`));

Check warning on line 141 in packages/mocha/index.js

View workflow job for this annotation

GitHub Actions / tests (v18)

Unexpected console statement

Check warning on line 141 in packages/mocha/index.js

View workflow job for this annotation

GitHub Actions / tests (v20)

Unexpected console statement

Check warning on line 141 in packages/mocha/index.js

View workflow job for this annotation

GitHub Actions / tests (v21)

Unexpected console statement
return;
}
this.#reporter = new Reporter(this, this.#mochaOptions);
this.emit(EVENT_RUN_BEGIN);
}

get suite() {
return this.#current;
}

end() {
if (!this.#reporter) {
return;
Expand Down
3 changes: 3 additions & 0 deletions packages/mocha/tests/customReporter/reporter.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,13 @@

'use strict';

const assert = require('assert');

class Reporter {
constructor(runner) {
assert(runner.suite, 'missing root suite');
runner.on('test end', (test) => {
console.log({

Check warning on line 11 in packages/mocha/tests/customReporter/reporter.js

View workflow job for this annotation

GitHub Actions / tests (v18)

Unexpected console statement

Check warning on line 11 in packages/mocha/tests/customReporter/reporter.js

View workflow job for this annotation

GitHub Actions / tests (v20)

Unexpected console statement

Check warning on line 11 in packages/mocha/tests/customReporter/reporter.js

View workflow job for this annotation

GitHub Actions / tests (v21)

Unexpected console statement
state: test.state,
isPending: test.isPending(),
currentRetry: test.currentRetry(),
Expand Down
Loading