@@ -5,16 +5,17 @@ import {After, Before, When} from '@cucumber/cucumber';
5
5
import stubbedFs from 'mock-fs' ;
6
6
import any from '@travi/any' ;
7
7
import debugTest from 'debug' ;
8
+ import yaml from 'js-yaml' ;
8
9
9
10
const debug = debugTest ( 'test' ) ;
10
11
const __dirname = dirname ( fileURLToPath ( import . meta. url ) ) ; // eslint-disable-line no-underscore-dangle
11
12
const stubbedNodeModules = stubbedFs . load ( resolve ( __dirname , '..' , '..' , '..' , '..' , 'node_modules' ) ) ;
12
13
13
- let scaffold ;
14
+ let scaffold , test , lift ;
14
15
15
16
Before ( async function ( ) {
16
17
// eslint-disable-next-line import/no-extraneous-dependencies,import/no-unresolved
17
- ( { scaffold} = await import ( '@form8ion/github' ) ) ;
18
+ ( { scaffold, test , lift } = await import ( '@form8ion/github' ) ) ;
18
19
19
20
this . projectName = any . word ( ) ;
20
21
this . projectRoot = process . cwd ( ) ;
@@ -42,3 +43,27 @@ When('the project is scaffolded', async function () {
42
43
this . scaffoldError = err ;
43
44
}
44
45
} ) ;
46
+
47
+ When ( 'the scaffolder results are processed' , async function ( ) {
48
+ this . tags = any . listOf ( any . word ) ;
49
+ this . existingSettingsContent = { ...any . simpleObject ( ) , repository : any . simpleObject ( ) } ;
50
+
51
+ stubbedFs ( {
52
+ ...this . github && {
53
+ '.github' : {
54
+ ...this . settingsApp && { 'settings.yml' : yaml . dump ( this . existingSettingsContent ) }
55
+ }
56
+ } ,
57
+ node_modules : stubbedNodeModules
58
+ } ) ;
59
+
60
+ if ( await test ( { projectRoot : this . projectRoot } ) ) {
61
+ await lift ( {
62
+ projectRoot : this . projectRoot ,
63
+ results : {
64
+ projectDetails : this . projectDetails ,
65
+ tags : this . tags
66
+ }
67
+ } ) ;
68
+ }
69
+ } ) ;
0 commit comments