@@ -422,19 +422,8 @@ class NightwatchDevToolsPlugin {
422422 this . suiteManager . finalizeSuiteState ( featureSuite )
423423 }
424424
425- if ( scenarioState === TEST_STATE . PASSED ) {
426- this . #passCount++
427- } else if ( scenarioState === TEST_STATE . SKIPPED ) {
428- this . #skipCount++
429- } else {
430- this . #failCount++
431- }
432- const icon =
433- scenarioState === TEST_STATE . PASSED
434- ? '✅'
435- : scenarioState === TEST_STATE . SKIPPED
436- ? '⏭'
437- : '❌'
425+ this . #incrementCount( scenarioState )
426+ const icon = this . #testIcon( scenarioState )
438427 const durationSec = ( duration / 1000 ) . toFixed ( 2 )
439428 log . info ( ` ${ icon } ${ pickle ?. name ?? 'Unknown' } (${ durationSec } s)` )
440429
@@ -588,19 +577,8 @@ class NightwatchDevToolsPlugin {
588577 runningTest . _duration = parseFloat ( testcase . time || '0' ) * 1000
589578 this . testManager . updateTestState ( runningTest , testState )
590579 this . testManager . markTestAsProcessed ( testFile , runningTest . title )
591- if ( testState === TEST_STATE . PASSED ) {
592- this . #passCount++
593- } else if ( testState === TEST_STATE . SKIPPED ) {
594- this . #skipCount++
595- } else {
596- this . #failCount++
597- }
598- const prevIcon =
599- testState === TEST_STATE . PASSED
600- ? '✅'
601- : testState === TEST_STATE . SKIPPED
602- ? '⏭'
603- : '❌'
580+ this . #incrementCount( testState )
581+ const prevIcon = this . #testIcon( testState )
604582 log . info (
605583 ` ${ prevIcon } ${ runningTest . title } (${ ( runningTest . _duration / 1000 ) . toFixed ( 2 ) } s)`
606584 )
@@ -701,12 +679,8 @@ class NightwatchDevToolsPlugin {
701679 duration
702680 )
703681 this . testManager . markTestAsProcessed ( testFile , runningTest . title )
704- if ( testState === TEST_STATE . PASSED ) {
705- this . #passCount++
706- } else {
707- this . #failCount++
708- }
709- const icon = testState === TEST_STATE . PASSED ? '✅' : '❌'
682+ this . #incrementCount( testState )
683+ const icon = this . #testIcon( testState )
710684 log . info (
711685 ` ${ icon } ${ runningTest . title } (${ ( duration / 1000 ) . toFixed ( 2 ) } s)`
712686 )
@@ -732,19 +706,8 @@ class NightwatchDevToolsPlugin {
732706 new Date ( ) ,
733707 dur
734708 )
735- if ( testState === TEST_STATE . PASSED ) {
736- this . #passCount++
737- } else if ( testState === TEST_STATE . SKIPPED ) {
738- this . #skipCount++
739- } else {
740- this . #failCount++
741- }
742- const icon =
743- testState === TEST_STATE . PASSED
744- ? '✅'
745- : testState === TEST_STATE . SKIPPED
746- ? '⏭'
747- : '❌'
709+ this . #incrementCount( testState )
710+ const icon = this . #testIcon( testState )
748711 log . info (
749712 ` ${ icon } ${ currentTestName } (${ ( dur / 1000 ) . toFixed ( 2 ) } s)`
750713 )
@@ -855,6 +818,24 @@ class NightwatchDevToolsPlugin {
855818 }
856819 }
857820
821+ #incrementCount( state : TestStats [ 'state' ] ) : void {
822+ if ( state === TEST_STATE . PASSED ) {
823+ this . #passCount++
824+ } else if ( state === TEST_STATE . SKIPPED ) {
825+ this . #skipCount++
826+ } else {
827+ this . #failCount++
828+ }
829+ }
830+
831+ #testIcon( state : TestStats [ 'state' ] ) : string {
832+ return state === TEST_STATE . PASSED
833+ ? '✅'
834+ : state === TEST_STATE . SKIPPED
835+ ? '⏭'
836+ : '❌'
837+ }
838+
858839 registerEventHandlers ( eventHub : any ) : void {
859840 this . #isCucumberRunner = eventHub . runner === 'cucumber'
860841 if ( this . #isCucumberRunner) {
0 commit comments