1+ import chalk from 'chalk'
12import { getConfig , getTestRoot } from './utils.js'
23import Config from '../config.js'
34import Codecept from '../codecept.js'
@@ -8,6 +9,7 @@ import Container from '../container.js'
89
910export default async function ( test , options ) {
1011 if ( options . grep ) process . env . grep = options . grep
12+ if ( options . ansi === false ) chalk . level = 0
1113 const configFile = options . config
1214 let codecept
1315
@@ -37,6 +39,7 @@ export default async function (test, options) {
3739 await printTests ( codecept . testFiles )
3840 return
3941 }
42+ if ( options . numbers ) numberSteps ( )
4043 event . dispatcher . on ( event . all . result , printFooter )
4144 await codecept . run ( test )
4245 } catch ( err ) {
@@ -45,6 +48,17 @@ export default async function (test, options) {
4548 }
4649}
4750
51+ function numberSteps ( ) {
52+ let stepIndex = 0
53+ event . dispatcher . on ( event . test . before , ( ) => {
54+ stepIndex = 0
55+ } )
56+ event . dispatcher . prependListener ( event . step . before , step => {
57+ stepIndex ++
58+ step . prefix = `${ stepIndex } . ${ step . prefix || '' } `
59+ } )
60+ }
61+
4862async function printTests ( files ) {
4963 const { default : figures } = await import ( 'figures' )
5064 const { default : colors } = await import ( 'chalk' )
0 commit comments