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'
5
5
import path from 'path'
6
6
import util from 'util'
7
7
8
- import { print , success , error } from '../output.js'
8
+ import output from '../output.js'
9
+ const { print, success, error } = output
9
10
import { fileExists } from '../utils.js'
10
11
import { getTestRoot } from './utils.js'
11
12
Original file line number Diff line number Diff line change @@ -6,7 +6,8 @@ import path from 'path'
6
6
import { inspect } from 'util'
7
7
import spawn from 'cross-spawn'
8
8
9
- import { print , success , error } from '../output.js'
9
+ import output from '../output.js'
10
+ const { print, success, error } = output
10
11
import { fileExists , beautify , installedLocally } from '../utils.js'
11
12
import { getTestRoot } from './utils.js'
12
13
import generateDefinitions from './definitions.js'
Original file line number Diff line number Diff line change 1
1
import StepConfig from './step/config.js'
2
- import Section from './step/section.js'
2
+ import SectionClass from './step/section.js'
3
3
function stepOpts ( opts = { } ) {
4
4
return new StepConfig ( opts )
5
5
}
@@ -14,11 +14,11 @@ function stepRetry(retry) {
14
14
15
15
function section ( name ) {
16
16
if ( ! name ) return endSection ( )
17
- return new Section ( name ) . start ( )
17
+ return new SectionClass ( name ) . start ( )
18
18
}
19
19
20
20
function endSection ( ) {
21
- return Section . current ( ) . end ( )
21
+ return SectionClass . current ( ) . end ( )
22
22
}
23
23
24
24
// Section function to be added here
@@ -48,3 +48,7 @@ const step = {
48
48
}
49
49
50
50
export 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
+
1
3
class CustomHelper extends Helper {
2
4
act ( ) {
3
5
this . debug ( JSON . stringify ( arguments ) )
4
6
}
5
7
}
6
8
7
- module . exports = CustomHelper
9
+ export default CustomHelper
Original file line number Diff line number Diff line change 1
1
const { I } = inject ( )
2
2
3
- module . exports = {
3
+ export default {
4
4
actOnPage : ( ) => {
5
5
I . act ( 'actOnPage' )
6
6
I . act ( 'see on this page' )
Original file line number Diff line number Diff line change
1
+ import Helper from '../../../../../lib/helper.js'
2
+
1
3
function sleep ( ms ) {
2
- return new Promise ( ( resolve ) => {
3
- setTimeout ( resolve , ms ) ;
4
- } ) ;
4
+ return new Promise ( resolve => {
5
+ setTimeout ( resolve , ms )
6
+ } )
5
7
}
6
8
7
9
class CustomHelper extends Helper {
8
10
exceededByTimeout ( ms ) {
9
- return sleep ( ms ) ;
11
+ return sleep ( ms )
10
12
}
11
13
12
14
waitForSleep ( ms ) {
13
- return sleep ( ms ) ;
15
+ return sleep ( ms )
14
16
}
15
17
16
18
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 )
19
21
}
20
22
21
23
waitTadLonger ( ms ) {
22
- return sleep ( ms ) ;
24
+ return sleep ( ms )
23
25
}
24
26
25
27
waitTadShorter ( ms ) {
26
- return sleep ( ms ) ;
28
+ return sleep ( ms )
27
29
}
28
30
}
29
31
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 ( )
3
2
4
- Feature ( 'Steps' ) ;
3
+ Feature ( 'Steps' )
5
4
6
5
Scenario ( 'Default command timeout' , ( { I } ) => {
7
- I . exceededByTimeout ( 1500 ) ;
8
- } ) ;
6
+ I . exceededByTimeout ( 1500 )
7
+ } )
9
8
10
9
Scenario ( 'Wait command timeout' , ( { I } ) => {
11
- I . waitForSleep ( 1500 ) ;
12
- } ) ;
10
+ I . waitForSleep ( 1500 )
11
+ } )
13
12
14
13
Scenario ( 'Rerun sleep' , ( { I } ) => {
15
- I . retry ( 2 ) . statefulSleep ( 2250 ) ;
16
- } ) ;
14
+ I . retry ( 2 ) . statefulSleep ( 2250 )
15
+ } )
17
16
18
17
Scenario ( 'Wait with longer timeout' , ( { I } ) => {
19
- I . waitTadLonger ( 750 ) ;
20
- } ) ;
18
+ I . waitTadLonger ( 750 )
19
+ } )
21
20
22
21
Scenario ( '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'
2
2
3
3
class CustomHelper extends Helper {
4
4
shouldDoSomething ( s ) { }
5
5
6
6
fail ( ) {
7
- throw new Error ( 'Failed from helper' ) ;
7
+ throw new Error ( 'Failed from helper' )
8
8
}
9
9
}
10
10
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
8
13
9
14
const runner = path . join ( __dirname , '../../bin/codecept.js' )
10
15
const codecept_dir = path . join ( __dirname , '/../data/sandbox/configs/init' )
You can’t perform that action at this time.
0 commit comments