@@ -82,8 +82,8 @@ module.exports = class AllureReporter {
8282 get testNameForAttachment ( ) {
8383 const cyTest = cy . state ( ) . test ;
8484 return (
85- cyTest ? .title ||
86- this . currentTest ?. info . name ||
85+ ( cyTest && cyTest . title ) ||
86+ ( this . currentTest && this . currentTest . info . name ) ||
8787 this . previousTestName
8888 ) ;
8989 }
@@ -244,15 +244,19 @@ module.exports = class AllureReporter {
244244 this . currentTest . info . stage = Stage . RUNNING ;
245245 this . addPackageLabel ( ) ;
246246
247- if ( config ?. clearFilesForPreviousAttempt ( ) && test . _currentRetry > 0 ) {
247+ if (
248+ config &&
249+ config . clearFilesForPreviousAttempt ( ) &&
250+ test . _currentRetry > 0
251+ ) {
248252 logger . allure ( `clearing screenshots from previous retries` ) ;
249253 // remove screenshots from previous attempt
250254 this . files = this . files . filter (
251255 ( file ) => file . testName !== test . title
252256 ) ;
253257 }
254258
255- if ( config ? .addAnalyticLabels ( ) ) {
259+ if ( config && config . addAnalyticLabels ( ) ) {
256260 logger . allure ( `adding analytic labels` ) ;
257261 this . currentTest . addLabel ( LabelName . FRAMEWORK , 'Cypress' ) ;
258262 const language = languageLabel ( test ) ;
@@ -387,9 +391,12 @@ module.exports = class AllureReporter {
387391 }
388392
389393 finishRemainingSteps ( status = Status . PASSED ) {
390- const alreadyHasFailedStep = this . currentTest ?. info ?. steps . some (
391- ( step ) => step . status === Status . FAILED
392- ) ;
394+ const alreadyHasFailedStep =
395+ this . currentTest &&
396+ this . currentTest . info &&
397+ this . currentTest . info . steps . some (
398+ ( step ) => step . status === Status . FAILED
399+ ) ;
393400
394401 this . steps . forEach ( ( step ) => {
395402 step . info . stage = Stage . FINISHED ;
@@ -474,7 +481,7 @@ module.exports = class AllureReporter {
474481
475482 // in case hook is a step we should complete it
476483 if ( this . originalNameOf ( hook ) . includes ( 'each' ) ) {
477- this . currentHook ? .endStep ( ) ;
484+ this . currentHook && this . currentHook . endStep ( ) ;
478485 }
479486 ! isAllureReport && ! failed && ( this . currentHook = null ) ;
480487 this . finishRemainingSteps ( currentHookInfo . status ) ;
@@ -527,7 +534,8 @@ module.exports = class AllureReporter {
527534 }
528535 // update test, which may had a pending event previously
529536 if (
530- test ?. state &&
537+ test &&
538+ test . state &&
531539 [ Status . FAILED , Status . PASSED , Status . SKIPPED ] . includes ( test . state )
532540 ) {
533541 this . updateTest (
0 commit comments