File tree Expand file tree Collapse file tree 9 files changed +54
-40
lines changed
Expand file tree Collapse file tree 9 files changed +54
-40
lines changed Original file line number Diff line number Diff line change @@ -5,7 +5,8 @@ import { mkdirp } from 'mkdirp'
55import path from 'path'
66import util from 'util'
77
8- import { print , success , error } from '../output.js'
8+ import output from '../output.js'
9+ const { print, success, error } = output
910import { fileExists } from '../utils.js'
1011import { getTestRoot } from './utils.js'
1112
Original file line number Diff line number Diff line change @@ -6,7 +6,8 @@ import path from 'path'
66import { inspect } from 'util'
77import spawn from 'cross-spawn'
88
9- import { print , success , error } from '../output.js'
9+ import output from '../output.js'
10+ const { print, success, error } = output
1011import { fileExists , beautify , installedLocally } from '../utils.js'
1112import { getTestRoot } from './utils.js'
1213import generateDefinitions from './definitions.js'
Original file line number Diff line number Diff line change 11import StepConfig from './step/config.js'
2- import Section from './step/section.js'
2+ import SectionClass from './step/section.js'
33function stepOpts ( opts = { } ) {
44 return new StepConfig ( opts )
55}
@@ -14,11 +14,11 @@ function stepRetry(retry) {
1414
1515function section ( name ) {
1616 if ( ! name ) return endSection ( )
17- return new Section ( name ) . start ( )
17+ return new SectionClass ( name ) . start ( )
1818}
1919
2020function endSection ( ) {
21- return Section . current ( ) . end ( )
21+ return SectionClass . current ( ) . end ( )
2222}
2323
2424// Section function to be added here
@@ -48,3 +48,7 @@ const step = {
4848}
4949
5050export default step
51+
52+ // Named exports for ESM compatibility
53+ export const Section = step . Section
54+ export const EndSection = step . EndSection
Original file line number Diff line number Diff line change 1+ import Helper from '../../../../../lib/helper.js'
2+
13class CustomHelper extends Helper {
24 act ( ) {
35 this . debug ( JSON . stringify ( arguments ) )
46 }
57}
68
7- module . exports = CustomHelper
9+ export default CustomHelper
Original file line number Diff line number Diff line change 11const { I } = inject ( )
22
3- module . exports = {
3+ export default {
44 actOnPage : ( ) => {
55 I . act ( 'actOnPage' )
66 I . act ( 'see on this page' )
Original file line number Diff line number Diff line change 1+ import Helper from '../../../../../lib/helper.js'
2+
13function sleep ( ms ) {
2- return new Promise ( ( resolve ) => {
3- setTimeout ( resolve , ms ) ;
4- } ) ;
4+ return new Promise ( resolve => {
5+ setTimeout ( resolve , ms )
6+ } )
57}
68
79class CustomHelper extends Helper {
810 exceededByTimeout ( ms ) {
9- return sleep ( ms ) ;
11+ return sleep ( ms )
1012 }
1113
1214 waitForSleep ( ms ) {
13- return sleep ( ms ) ;
15+ return sleep ( ms )
1416 }
1517
1618 statefulSleep ( ms ) {
17- this . fraction = ++ this . fraction || 1 ;
18- return sleep ( ms - 500 * this . fraction ) ;
19+ this . fraction = ++ this . fraction || 1
20+ return sleep ( ms - 500 * this . fraction )
1921 }
2022
2123 waitTadLonger ( ms ) {
22- return sleep ( ms ) ;
24+ return sleep ( ms )
2325 }
2426
2527 waitTadShorter ( ms ) {
26- return sleep ( ms ) ;
28+ return sleep ( ms )
2729 }
2830}
2931
30- module . exports = CustomHelper ;
32+ export default CustomHelper
Original file line number Diff line number Diff line change 1- const given = when = then = global . codeceptjs . container . plugins ( 'commentStep' ) ;
2- const { I } = inject ( ) ;
1+ const { I } = inject ( )
32
4- Feature ( 'Steps' ) ;
3+ Feature ( 'Steps' )
54
65Scenario ( 'Default command timeout' , ( { I } ) => {
7- I . exceededByTimeout ( 1500 ) ;
8- } ) ;
6+ I . exceededByTimeout ( 1500 )
7+ } )
98
109Scenario ( 'Wait command timeout' , ( { I } ) => {
11- I . waitForSleep ( 1500 ) ;
12- } ) ;
10+ I . waitForSleep ( 1500 )
11+ } )
1312
1413Scenario ( 'Rerun sleep' , ( { I } ) => {
15- I . retry ( 2 ) . statefulSleep ( 2250 ) ;
16- } ) ;
14+ I . retry ( 2 ) . statefulSleep ( 2250 )
15+ } )
1716
1817Scenario ( 'Wait with longer timeout' , ( { I } ) => {
19- I . waitTadLonger ( 750 ) ;
20- } ) ;
18+ I . waitTadLonger ( 750 )
19+ } )
2120
2221Scenario ( 'Wait with shorter timeout' , ( { I } ) => {
23- I . waitTadShorter ( 750 ) ;
24- } ) ;
22+ I . waitTadShorter ( 750 )
23+ } )
Original file line number Diff line number Diff line change 1- // const Helper = require( '../../lib/helper');
1+ import Helper from '../../../../../ lib/helper.js'
22
33class CustomHelper extends Helper {
44 shouldDoSomething ( s ) { }
55
66 fail ( ) {
7- throw new Error ( 'Failed from helper' ) ;
7+ throw new Error ( 'Failed from helper' )
88 }
99}
1010
11- export default CustomHelper ;
11+ export default CustomHelper
Original file line number Diff line number Diff line change 1- import chai from 'chai' ;
2- chai . should ( ) ;
3- import { DOWN , ENTER } from 'inquirer-test' ;
4- import path from 'path' ;
5- import { fileURLToPath } from 'url' ;
6- const __filename = fileURLToPath ( import . meta. url ) ;
7- const __dirname = path . dirname ( __filename ) ;
1+ import chai from 'chai'
2+ chai . should ( )
3+ import { DOWN , ENTER } from 'inquirer-test'
4+ import inquirerTest from 'inquirer-test'
5+ import path from 'path'
6+ import fs from 'fs'
7+ import { mkdirp } from 'mkdirp'
8+ import { fileURLToPath } from 'url'
9+ const __filename = fileURLToPath ( import . meta. url )
10+ const __dirname = path . dirname ( __filename )
11+
12+ const run = inquirerTest
813
914const runner = path . join ( __dirname , '../../bin/codecept.js' )
1015const codecept_dir = path . join ( __dirname , '/../data/sandbox/configs/init' )
You can’t perform that action at this time.
0 commit comments