@@ -7,7 +7,6 @@ import debugModule from 'debug'
77const debug = debugModule ( 'codeceptjs:timeout' )
88import { TIMEOUT_ORDER , TimeoutError , TestTimeoutError , StepTimeoutError } from '../timeout.js'
99import { BeforeSuiteHook , AfterSuiteHook } from '../mocha/hooks.js'
10- import { extractStepCode } from '../step.js'
1110
1211export default function ( ) {
1312 let timeout
@@ -123,15 +122,15 @@ export default function () {
123122 if ( typeof timeout !== 'number' ) return
124123
125124 if ( ! store . timeouts ) {
126- debug ( 'step' , extractStepCode ( step ) , 'timeout disabled' )
125+ debug ( 'step' , step . toCode ( ) . trim ( ) , 'timeout disabled' )
127126 return
128127 }
129128
130129 if ( timeout < 0 ) {
131130 debug ( 'Previous steps timed out, setting timeout to 0.01s' )
132131 step . setTimeout ( 0.01 , TIMEOUT_ORDER . testOrSuite )
133132 } else {
134- debug ( `Setting timeout ${ timeout } ms for step ${ extractStepCode ( step ) } ` )
133+ debug ( `Setting timeout ${ timeout } ms for step ${ step . toCode ( ) . trim ( ) } ` )
135134 step . setTimeout ( timeout , TIMEOUT_ORDER . testOrSuite )
136135 }
137136 } )
@@ -159,17 +158,17 @@ export default function () {
159158
160159 event . dispatcher . on ( event . step . finished , step => {
161160 if ( ! store . timeouts ) {
162- debug ( 'step' , extractStepCode ( step ) , 'timeout disabled' )
161+ debug ( 'step' , step . toCode ( ) . trim ( ) , 'timeout disabled' )
163162 return
164163 }
165164
166165 if ( typeof timeout === 'number' ) debug ( 'Timeout' , timeout )
167166
168- debug ( `step ${ extractStepCode ( step ) } :${ step . status } duration` , step . duration )
167+ debug ( `step ${ step . toCode ( ) . trim ( ) } :${ step . status } duration` , step . duration )
169168 if ( typeof timeout === 'number' && ! Number . isNaN ( timeout ) ) timeout -= step . duration
170169
171170 if ( typeof timeout === 'number' && timeout <= 0 && recorder . isRunning ( ) ) {
172- debug ( `step ${ extractStepCode ( step ) } timed out` )
171+ debug ( `step ${ step . toCode ( ) . trim ( ) } timed out` )
173172 recorder . throw ( new TestTimeoutError ( currentTimeout ) )
174173 }
175174 } )
0 commit comments