@@ -69,10 +69,14 @@ export class TestRunner {
6969 const testSuite = new target ( ) ;
7070 console . log ( colors . white . bold ( `\n${ testName } ` ) ) ;
7171
72- await this . runTestCycle ( target , testSuite ) ;
72+ await this . runTestCycle ( target , testSuite , testName ) ;
7373 }
7474
75- private static async runTestCycle ( target : any , testSuite : any ) {
75+ private static async runTestCycle (
76+ target : any ,
77+ testSuite : any ,
78+ testSuiteName : string ,
79+ ) {
7680 const testCases : ITestCase [ ] = target . testCases || [ ] ;
7781 const dataSetsArray : IDataSet [ ] = target . testCasesDataSets || [ ] ;
7882 const dataTableArray : IDataTableArray [ ] = target . testCasesDataTable || [ ] ;
@@ -88,6 +92,7 @@ export class TestRunner {
8892 await this . runLifecycleMethods ( testSuite , beforeEach , 'beforeEach' ) ;
8993 await this . runTestCase (
9094 testSuite ,
95+ testSuiteName ,
9196 methodName ,
9297 caseDescription ,
9398 dataSetsArray ,
@@ -132,6 +137,7 @@ export class TestRunner {
132137
133138 private static async runTestCase (
134139 testSuiteInstance : any ,
140+ testSuiteName : string ,
135141 methodName : string ,
136142 caseDescription : string ,
137143 dataSetsArray : IDataSet [ ] ,
@@ -140,7 +146,7 @@ export class TestRunner {
140146 ) {
141147 const startTime = performance . now ( ) ;
142148 let status : 'PASSED' | 'FAILED' = 'FAILED' ;
143- let error : string = '' ;
149+ let error : string | undefined = '' ;
144150 let duration : number = 0 ;
145151
146152 try {
@@ -162,14 +168,18 @@ export class TestRunner {
162168 this . log . logTestResult ( caseDescription || methodName , status , 'grey' ) ;
163169 } catch ( e : unknown ) {
164170 status = 'FAILED' ;
165- error = e instanceof Error ? e . message : `Unknown error: ${ e } ` ;
166171 this . isAllPassed = false ;
167- this . log . handleError ( e , methodName , caseDescription , testSuiteInstance ) ;
172+ error = this . log . handleError (
173+ e ,
174+ methodName ,
175+ caseDescription ,
176+ testSuiteInstance ,
177+ ) ;
168178 } finally {
169179 duration = performance . now ( ) - startTime ;
170180 this . reportTestResult (
171- testSuiteInstance ,
172- methodName ,
181+ testSuiteName ,
182+ caseDescription || methodName ,
173183 status ,
174184 duration ,
175185 error ,
@@ -178,19 +188,19 @@ export class TestRunner {
178188 }
179189
180190 private static reportTestResult (
181- testSuiteInstance : any ,
191+ testSuiteName : string ,
182192 methodName : string ,
183193 status : 'PASSED' | 'FAILED' ,
184194 duration : number ,
185- error : string ,
195+ error ? : string ,
186196 ) {
187197 if (
188198 this . isReportingEnabled &&
189199 this . reporterModule ?. ReportBuilder &&
190200 this . reporterModule ?. ReportsRegistry
191201 ) {
192202 const reportBuilder = new this . reporterModule . ReportBuilder (
193- testSuiteInstance . constructor . name ,
203+ testSuiteName ,
194204 methodName ,
195205 )
196206 . status ( status )
0 commit comments