diff --git a/src/custom-reporter.js b/src/custom-reporter.js index 33f2ffa..1164e69 100644 --- a/src/custom-reporter.js +++ b/src/custom-reporter.js @@ -2,20 +2,18 @@ class CustomReporter { constructor(globalConfig, options) { this._globalConfig = globalConfig; this._options = options; - this.totalTests = 0; - this.testCount = 0; + this.totalSuites = 0; + this.suitesCount = 0; } - onRunStart(test, testSuiteResults) { - testSuiteResults.testResults.forEach((suite) => { - this.totalTests += suite.numPassingTests + suite.numFailingTests + suite.numPendingTests; - }); - console.log(`Total tests found: ${this.totalTests}`); + onRunStart(test) { + this.totalSuites = test.numTotalTestSuites; + console.log('Total test suites:', this.totalSuites); } - onTestResult(test, testResult, aggregatedResult) { - this.testCount += testResult.numPassingTests + testResult.numFailingTests + testResult.numPendingTests; - console.log(`Progress: ${this.testCount}/${this.totalTests}`); + onTestResult() { + this.suitesCount += 1; + console.log(`Progress: ${this.suitesCount}/${this.totalSuites}`); } } diff --git a/src/modules/test_runs/testRun.controller.ts b/src/modules/test_runs/testRun.controller.ts index 71e6690..8e03ac0 100644 --- a/src/modules/test_runs/testRun.controller.ts +++ b/src/modules/test_runs/testRun.controller.ts @@ -40,8 +40,7 @@ export class TestRunController { globals: JSON.stringify({ SESSION_ID: sessionId, }), - reporters: ['default', '/src/custom-reporter.js'], - // reporters: ['default', 'jest-progress-bar-reporter'], + reporters: ['default', ['/src/custom-reporter.js', { SESSION_ID: sessionId }]], }, ...optionsWithTest, };