@@ -34,7 +34,7 @@ describe('Definitions', function () {
3434
3535 describe ( 'Static files' , ( ) => {
3636 it ( 'should have internal object that is available as variable codeceptjs' , ( done ) => {
37- exec ( `${ runner } def --config ${ codecept_dir } /codecept.inject.po.json ` , ( ) => {
37+ exec ( `${ runner } def --config ${ codecept_dir } /codecept.inject.po.js ` , ( ) => {
3838 const types = typesFrom ( `${ codecept_dir } /steps.d.ts` ) ;
3939 types . should . be . valid ;
4040
@@ -79,7 +79,7 @@ describe('Definitions', function () {
7979 } ) ;
8080
8181 it ( 'def should create definition file with correct page def' , ( done ) => {
82- exec ( `${ runner } def --config ${ codecept_dir } /codecept.inject.po.json ` , ( err , stdout ) => {
82+ exec ( `${ runner } def --config ${ codecept_dir } /codecept.inject.po.js ` , ( err , stdout ) => {
8383 stdout . should . include ( 'Definitions were generated in steps.d.ts' ) ;
8484 const types = typesFrom ( `${ codecept_dir } /steps.d.ts` ) ;
8585 types . should . be . valid ;
@@ -94,7 +94,7 @@ describe('Definitions', function () {
9494 } ) ;
9595
9696 it ( 'def should create definition file given a config file' , ( done ) => {
97- exec ( `${ runner } def --config ${ codecept_dir } /../../codecept.ddt.json ` , ( err , stdout ) => {
97+ exec ( `${ runner } def --config ${ codecept_dir } /../../codecept.ddt.js ` , ( err , stdout ) => {
9898 stdout . should . include ( 'Definitions were generated in steps.d.ts' ) ;
9999 const types = typesFrom ( `${ codecept_dir } /../../steps.d.ts` ) ;
100100 types . should . be . valid ;
@@ -104,7 +104,7 @@ describe('Definitions', function () {
104104 } ) ;
105105
106106 it ( 'def should create definition file with support object' , ( done ) => {
107- exec ( `${ runner } def --config ${ codecept_dir } /codecept.inject.po.json ` , ( ) => {
107+ exec ( `${ runner } def --config ${ codecept_dir } /codecept.inject.po.js ` , ( ) => {
108108 const types = typesFrom ( `${ codecept_dir } /steps.d.ts` ) ;
109109 types . should . be . valid ;
110110
@@ -128,7 +128,7 @@ describe('Definitions', function () {
128128 } ) ;
129129
130130 it ( 'def should create definition file with inject which contains support objects' , ( done ) => {
131- exec ( `${ runner } def --config ${ codecept_dir } /codecept.inject.po.json ` , ( ) => {
131+ exec ( `${ runner } def --config ${ codecept_dir } /codecept.inject.po.js ` , ( ) => {
132132 const types = typesFrom ( `${ codecept_dir } /steps.d.ts` ) ;
133133 types . should . be . valid ;
134134
@@ -145,7 +145,7 @@ describe('Definitions', function () {
145145 } ) ;
146146
147147 it ( 'def should create definition file with inject which contains I object' , ( done ) => {
148- exec ( `${ runner } def --config ${ codecept_dir } /codecept.inject.po.json ` , ( err ) => {
148+ exec ( `${ runner } def --config ${ codecept_dir } /codecept.inject.po.js ` , ( err ) => {
149149 assert ( ! err ) ;
150150 const types = typesFrom ( `${ codecept_dir } /steps.d.ts` ) ;
151151 types . should . be . valid ;
@@ -165,7 +165,7 @@ describe('Definitions', function () {
165165 } ) ;
166166
167167 it ( 'def should create definition file with inject which contains I object from helpers' , ( done ) => {
168- exec ( `${ runner } def --config ${ codecept_dir } // codecept.inject.powi.json ` , ( ) => {
168+ exec ( `${ runner } def --config ${ codecept_dir } /codecept.inject.powi.js ` , ( ) => {
169169 const types = typesFrom ( `${ codecept_dir } /steps.d.ts` ) ;
170170 types . should . be . valid ;
171171
@@ -179,7 +179,7 @@ describe('Definitions', function () {
179179 } ) ;
180180
181181 it ( 'def should create definition file with callback params' , ( done ) => {
182- exec ( `${ runner } def --config ${ codecept_dir } /codecept.inject.po.json ` , ( ) => {
182+ exec ( `${ runner } def --config ${ codecept_dir } /codecept.inject.po.js ` , ( ) => {
183183 const types = typesFrom ( `${ codecept_dir } /steps.d.ts` ) ;
184184 types . should . be . valid ;
185185
@@ -193,6 +193,30 @@ describe('Definitions', function () {
193193 done ( ) ;
194194 } ) ;
195195 } ) ;
196+
197+ it ( 'def should create definition file with promise-based feature' , ( done ) => {
198+ exec ( `${ runner } def --config ${ codecept_dir } /codecept.promise.based.js` , ( err , stdout ) => {
199+ stdout . should . include ( 'Definitions were generated in steps.d.ts' ) ;
200+ const types = typesFrom ( `${ codecept_dir } /steps.d.ts` ) ;
201+ types . should . be . valid ;
202+
203+ const definitionFile = types . getSourceFileOrThrow ( `${ codecept_dir } /steps.d.ts` ) ;
204+ const extend = getExtends ( definitionFile . getNamespaceOrThrow ( 'CodeceptJS' ) . getInterfaceOrThrow ( 'I' ) ) ;
205+ extend . should . containSubset ( [ {
206+ methods : [ {
207+ name : 'amInPath' ,
208+ returnType : 'Promise<any>' ,
209+ parameters : [ { name : 'openPath' , type : 'string' } ] ,
210+ } , {
211+ name : 'seeFile' ,
212+ returnType : 'Promise<any>' ,
213+ parameters : [ { name : 'name' , type : 'string' } ] ,
214+ } ] ,
215+ } ] ) ;
216+ assert ( ! err ) ;
217+ done ( ) ;
218+ } ) ;
219+ } ) ;
196220} ) ;
197221
198222/** @type {Chai.ChaiPlugin */
0 commit comments