-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #10 from beda-software/custom-reporter
Custom reporter
- Loading branch information
Showing
5 changed files
with
79 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
class CustomReporter { | ||
constructor(globalConfig, options) { | ||
this._globalConfig = globalConfig; | ||
this._options = options; | ||
this.totalSuites = 0; | ||
this.suitesCount = 0; | ||
this.testRunId = this._options.TEST_RUN_ID; | ||
this.testRunService = this._options.TEST_RUN_SERVICE; | ||
} | ||
|
||
async onRunStart(test) { | ||
this.totalSuites = test.numTotalTestSuites; | ||
const testRun = await this.testRunService.findOne(this.testRunId); | ||
await this.testRunService.update({ ...testRun, ...{ suiteTotal: this.totalSuites, status: 'running' } }); | ||
} | ||
|
||
onTestStart() { | ||
// Just for the info; | ||
} | ||
|
||
async onTestResult() { | ||
this.suitesCount += 1; | ||
const testRun = await this.testRunService.findOne(this.testRunId); | ||
await this.testRunService.update({ ...testRun, ...{ suitePassed: this.suitesCount } }); | ||
} | ||
|
||
async onRunComplete() { | ||
const testRun = await this.testRunService.findOne(this.testRunId); | ||
await this.testRunService.update({ ...testRun, ...{ status: 'completed' } }); | ||
} | ||
} | ||
|
||
module.exports = CustomReporter; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters