diff --git a/qase-mocha/changelog.md b/qase-mocha/changelog.md index 8c6cadf9..fa01c33c 100644 --- a/qase-mocha/changelog.md +++ b/qase-mocha/changelog.md @@ -1,3 +1,9 @@ +# qase-mocha@1.0.0-beta.4 + +## What's new + +Fixed the issue with async tests not being reported correctly. + # qase-mocha@1.0.0-beta.3 ## What's new diff --git a/qase-mocha/package.json b/qase-mocha/package.json index a0afd47b..cae0f1f6 100644 --- a/qase-mocha/package.json +++ b/qase-mocha/package.json @@ -1,6 +1,6 @@ { "name": "mocha-qase-reporter", - "version": "1.0.0-beta.3", + "version": "1.0.0-beta.4", "description": "Mocha Cypress Reporter", "homepage": "https://github.com/qase-tms/qase-javascript", "sideEffects": false, diff --git a/qase-mocha/src/reporter.ts b/qase-mocha/src/reporter.ts index 21241e23..7180d8a3 100644 --- a/qase-mocha/src/reporter.ts +++ b/qase-mocha/src/reporter.ts @@ -86,7 +86,8 @@ export class MochaQaseReporter extends reporters.Base { this.runner.on(Events.EVENT_HOOK_BEGIN, (hook: Hook) => this.addMethods(hook.ctx)); this.runner.on(Events.EVENT_TEST_BEGIN, () => this.onStartTest()); - this.runner.on(Events.EVENT_TEST_END, (test) => this.onEndTest(test)); + // eslint-disable-next-line @typescript-eslint/no-misused-promises + this.runner.on(Events.EVENT_TEST_END, async (test) => await this.onEndTest(test)); }; private onStartRun() { @@ -116,7 +117,7 @@ export class MochaQaseReporter extends reporters.Base { this.currentType = 'test'; } - private onEndTest(test: Mocha.Test) { + private async onEndTest(test: Mocha.Test) { if (this.metadata.ignore) { return; } @@ -172,7 +173,8 @@ export class MochaQaseReporter extends reporters.Base { title: this.metadata.title && this.metadata.title != '' ? this.metadata.title : test.title, }; - deasyncPromise(this.reporter.addTestResult(result)); + await this.reporter.addTestResult(result); + this.metadata.clear(); this.currentTest = new currentTest(); }