@@ -38,21 +38,34 @@ module.exports = function (genPath) {
3838 let codecept = new Codecept ( config , { } ) ;
3939 codecept . init ( testsPath ) ;
4040 let helpers = container . helpers ( ) ;
41- let methods = '' ;
41+ let suppportI = container . support ( 'I' ) ;
42+ let methods = [ ] ;
43+ let actions = [ ] ;
4244 for ( let name in helpers ) {
4345 let helper = helpers [ name ] ;
4446 methodsOfObject ( helper ) . forEach ( ( action ) => {
4547 let params = getParamNames ( helper [ action ] ) ;
4648 if ( params ) params = params . join ( ', ' ) ;
4749 if ( ! params ) params = '' ;
48- methods += ` ${ ( action ) } : (${ params } ) => any; \n` ;
50+ methods . push ( ` ${ ( action ) } : (${ params } ) => any; \n` ) ;
51+ actions [ action ] = 1
4952 } ) ;
5053 }
51- let definitionsTemplate = template . replace ( '{{methods}}' , methods ) ;
54+ for ( let name in suppportI ) {
55+ if ( actions [ name ] ) {
56+ continue
57+ }
58+ let actor = suppportI [ name ] ;
59+ let params = getParamNames ( actor ) ;
60+ if ( params ) params = params . join ( ', ' ) ;
61+ if ( ! params ) params = '' ;
62+ methods . push ( ` ${ ( name ) } : (${ params } ) => any; \n` ) ;
63+ }
64+ let definitionsTemplate = template . replace ( '{{methods}}' , methods . join ( '' ) ) ;
5265 fs . writeFileSync ( path . join ( testsPath , 'steps.d.ts' ) , definitionsTemplate ) ;
5366 output . print ( 'TypeScript Definitions provide autocompletion in Visual Studio Code and other IDEs' ) ;
5467 output . print ( 'Definitions were generated in steps.d.ts' ) ;
5568 output . print ( 'Load them by adding at the top of a test file:' ) ;
5669 output . print ( output . colors . grey ( `\n/// <reference path="./steps.d.ts" />` ) ) ;
5770
58- }
71+ }
0 commit comments