@@ -9,7 +9,6 @@ import any from '@travi/any';
9
9
import { when } from 'jest-when' ;
10
10
11
11
import { scaffold as liftGit , initialize as scaffoldGit } from './vcs/git/git.js' ;
12
- import { scaffold as scaffoldVcsHost } from './vcs/host/index.js' ;
13
12
import * as licenseScaffolder from './license/scaffolder.js' ;
14
13
import scaffoldLanguage from './language/scaffolder.js' ;
15
14
import * as languagePrompt from './language/prompt.js' ;
@@ -27,7 +26,6 @@ vi.mock('@form8ion/execa-wrapper');
27
26
vi . mock ( '@form8ion/results-reporter' ) ;
28
27
vi . mock ( './readme' ) ;
29
28
vi . mock ( './vcs/git/git.js' ) ;
30
- vi . mock ( './vcs/host/index.js' ) ;
31
29
vi . mock ( './license/scaffolder' ) ;
32
30
vi . mock ( './language/scaffolder' ) ;
33
31
vi . mock ( './language/prompt' ) ;
@@ -52,8 +50,7 @@ describe('project scaffolder', () => {
52
50
const vcsHosts = any . simpleObject ( ) ;
53
51
const documentation = any . simpleObject ( ) ;
54
52
const vcs = any . simpleObject ( ) ;
55
- const vcsOriginDetails = any . simpleObject ( ) ;
56
- const vcsHostResults = { ...any . simpleObject ( ) , vcs : vcsOriginDetails } ;
53
+ const vcsResults = { ...any . simpleObject ( ) , vcs} ;
57
54
const tags = any . listOf ( any . word ) ;
58
55
const visibility = any . word ( ) ;
59
56
const vcsIgnore = any . simpleObject ( ) ;
@@ -112,24 +109,12 @@ describe('project scaffolder', () => {
112
109
. calledWith ( languages , decisions )
113
110
. mockResolvedValue ( { [ questionNames . PROJECT_LANGUAGE ] : projectLanguage } ) ;
114
111
when ( scaffoldGit )
115
- . calledWith ( gitRepoShouldBeInitialized , projectPath , projectName , vcsHosts , visibility , decisions )
116
- . mockResolvedValue ( vcs ) ;
112
+ . calledWith ( gitRepoShouldBeInitialized , projectPath , projectName , description , vcsHosts , visibility , decisions )
113
+ . mockResolvedValue ( vcsResults ) ;
117
114
liftGit . mockResolvedValue ( gitResults ) ;
118
115
when ( licenseScaffolder . default )
119
116
. calledWith ( { projectRoot : projectPath , license, copyright} )
120
117
. mockResolvedValue ( licenseResults ) ;
121
- when ( scaffoldVcsHost )
122
- . calledWith (
123
- vcsHosts ,
124
- {
125
- ...vcs ,
126
- projectRoot : projectPath ,
127
- projectName,
128
- description,
129
- visibility
130
- }
131
- )
132
- . mockResolvedValue ( vcsHostResults ) ;
133
118
scaffoldLanguage . mockResolvedValue ( languageResults ) ;
134
119
when ( dependencyUpdaterScaffolder . default )
135
120
. calledWith ( dependencyUpdaters , decisions , { projectRoot : projectPath , vcs} )
@@ -138,10 +123,7 @@ describe('project scaffolder', () => {
138
123
139
124
await scaffold ( options ) ;
140
125
141
- expect ( liftGit ) . toHaveBeenCalledWith ( {
142
- projectRoot : projectPath ,
143
- vcs : vcsOriginDetails
144
- } ) ;
126
+ expect ( liftGit ) . toHaveBeenCalledWith ( { projectRoot : projectPath , vcs} ) ;
145
127
expect ( scaffoldReadme ) . toHaveBeenCalledWith ( { projectName, projectRoot : projectPath , description} ) ;
146
128
expect ( dependencyUpdaterScaffolder . default ) . toHaveBeenCalledWith (
147
129
dependencyUpdaters ,
@@ -175,26 +157,13 @@ describe('project scaffolder', () => {
175
157
[ coreQuestionNames . PROJECT_NAME ] : projectName ,
176
158
[ questionNames . GIT_REPO ] : gitRepoShouldBeInitialized
177
159
} ) ;
178
-
179
- when ( scaffoldGit ) . mockResolvedValue ( vcs ) ;
160
+ when ( scaffoldGit ) . mockResolvedValue ( vcsResults ) ;
180
161
languagePrompt . default . mockResolvedValue ( { } ) ;
181
- when ( scaffoldVcsHost )
182
- . calledWith (
183
- { } ,
184
- {
185
- ...vcs ,
186
- projectRoot : projectPath ,
187
- projectName,
188
- description : undefined ,
189
- visibility : undefined
190
- }
191
- )
192
- . mockResolvedValue ( vcsHostResults ) ;
193
162
194
163
await scaffold ( ) ;
195
164
196
165
expect ( scaffoldGit )
197
- . toHaveBeenCalledWith ( gitRepoShouldBeInitialized , projectPath , projectName , { } , undefined , undefined ) ;
166
+ . toHaveBeenCalledWith ( gitRepoShouldBeInitialized , projectPath , projectName , undefined , { } , undefined , undefined ) ;
198
167
} ) ;
199
168
200
169
it ( 'should consider each option except the plugins map optional' , async ( ) => {
@@ -203,7 +172,6 @@ describe('project scaffolder', () => {
203
172
when ( prompts . promptForBaseDetails ) . calledWith ( projectPath , undefined ) . mockResolvedValue ( { } ) ;
204
173
languagePrompt . default . mockResolvedValue ( { } ) ;
205
174
scaffoldGit . mockResolvedValue ( { } ) ;
206
- scaffoldVcsHost . mockResolvedValue ( vcsHostResults ) ;
207
175
208
176
await scaffold ( emptyOptions ) ;
209
177
} ) ;
@@ -241,26 +209,14 @@ describe('project scaffolder', () => {
241
209
} ) ;
242
210
when ( scaffoldContributing ) . calledWith ( { visibility} ) . mockReturnValue ( { badges : contributingBadges } ) ;
243
211
scaffoldLanguage . mockResolvedValue ( languageResults ) ;
244
- when ( scaffoldVcsHost )
245
- . calledWith (
246
- vcsHosts ,
247
- {
248
- ...vcs ,
249
- projectRoot : projectPath ,
250
- projectName,
251
- description,
252
- visibility
253
- }
254
- )
255
- . mockResolvedValue ( vcsHostResults ) ;
256
212
dependencyUpdaterScaffolder . default . mockResolvedValue ( { badges : dependencyUpdaterBadges } ) ;
257
213
licenseScaffolder . default . mockResolvedValue ( { badges : licenseBadges } ) ;
258
214
languagePrompt . default . mockResolvedValue ( { } ) ;
259
- when ( scaffoldGit ) . mockResolvedValue ( vcs ) ;
215
+ when ( scaffoldGit ) . mockResolvedValue ( vcsResults ) ;
260
216
261
217
await scaffold ( options ) ;
262
218
263
- expect ( liftGit ) . toHaveBeenCalledWith ( { projectRoot : projectPath , vcs : vcsOriginDetails } ) ;
219
+ expect ( liftGit ) . toHaveBeenCalledWith ( { projectRoot : projectPath , vcs} ) ;
264
220
expect ( scaffoldReadme ) . toHaveBeenCalledWith ( { projectName, projectRoot : projectPath , description} ) ;
265
221
} ) ;
266
222
@@ -269,12 +225,11 @@ describe('project scaffolder', () => {
269
225
prompts . promptForBaseDetails . mockResolvedValue ( { [ questionNames . GIT_REPO ] : false } ) ;
270
226
languagePrompt . default . mockResolvedValue ( { } ) ;
271
227
scaffoldReadme . mockResolvedValue ( ) ;
272
- scaffoldGit . mockResolvedValue ( undefined ) ;
228
+ scaffoldGit . mockResolvedValue ( { } ) ;
273
229
274
230
await scaffold ( options ) ;
275
231
276
232
expect ( liftGit ) . not . toHaveBeenCalled ( ) ;
277
- expect ( scaffoldVcsHost ) . not . toHaveBeenCalled ( ) ;
278
233
expect ( dependencyUpdaterScaffolder . default ) . not . toHaveBeenCalled ( ) ;
279
234
} ) ;
280
235
@@ -303,7 +258,7 @@ describe('project scaffolder', () => {
303
258
when ( optionsValidator . validate )
304
259
. calledWith ( options )
305
260
. mockReturnValue ( { decisions, plugins : { languages, vcsHosts} } ) ;
306
- scaffoldGit . mockResolvedValue ( vcs ) ;
261
+ scaffoldGit . mockResolvedValue ( vcsResults ) ;
307
262
liftGit . mockResolvedValue ( gitResults ) ;
308
263
prompts . promptForBaseDetails . mockResolvedValue ( {
309
264
[ coreQuestionNames . PROJECT_NAME ] : projectName ,
@@ -323,24 +278,14 @@ describe('project scaffolder', () => {
323
278
vcs,
324
279
description
325
280
} ) . mockResolvedValue ( languageResults ) ;
326
- when ( scaffoldVcsHost ) . calledWith (
327
- vcsHosts ,
328
- {
329
- ...vcs ,
330
- projectRoot : projectPath ,
331
- projectName,
332
- description,
333
- visibility
334
- }
335
- ) . mockResolvedValue ( vcsHostResults ) ;
336
281
when ( execa ) . calledWith ( verificationCommand , { shell : true } ) . mockReturnValue ( { stdout : { pipe : execaPipe } } ) ;
337
282
dependencyUpdaterScaffolder . default . mockResolvedValue ( { } ) ;
338
283
licenseScaffolder . default . mockResolvedValue ( { } ) ;
339
284
scaffoldContributing . mockResolvedValue ( { } ) ;
340
285
341
286
await scaffold ( options ) ;
342
287
343
- expect ( liftGit ) . toHaveBeenCalledWith ( { projectRoot : projectPath , vcs : vcsOriginDetails } ) ;
288
+ expect ( liftGit ) . toHaveBeenCalledWith ( { projectRoot : projectPath , vcs} ) ;
344
289
expect ( scaffoldReadme ) . toHaveBeenCalledWith ( { projectName, projectRoot : projectPath , description} ) ;
345
290
expect ( execaPipe ) . toHaveBeenCalledWith ( process . stdout ) ;
346
291
expect ( resultsReporter . reportResults ) . toHaveBeenCalledWith ( { nextSteps : [ ...languageNextSteps , ...gitNextSteps ] } ) ;
@@ -350,7 +295,7 @@ describe('project scaffolder', () => {
350
295
when ( optionsValidator . validate )
351
296
. calledWith ( options )
352
297
. mockReturnValue ( { vcsHosts, decisions, plugins : { languages} } ) ;
353
- scaffoldGit . mockResolvedValue ( vcs ) ;
298
+ scaffoldGit . mockResolvedValue ( vcsResults ) ;
354
299
prompts . promptForBaseDetails . mockResolvedValue ( {
355
300
[ coreQuestionNames . PROJECT_NAME ] : projectName ,
356
301
[ coreQuestionNames . VISIBILITY ] : visibility ,
@@ -361,15 +306,14 @@ describe('project scaffolder', () => {
361
306
when ( languagePrompt . default )
362
307
. calledWith ( languages , decisions )
363
308
. mockResolvedValue ( { [ questionNames . PROJECT_LANGUAGE ] : projectLanguage } ) ;
364
- scaffoldVcsHost . mockResolvedValue ( vcsHostResults ) ;
365
309
scaffoldLanguage . mockResolvedValue ( { } ) ;
366
310
dependencyUpdaterScaffolder . default . mockResolvedValue ( { } ) ;
367
311
licenseScaffolder . default . mockResolvedValue ( { } ) ;
368
312
scaffoldContributing . mockResolvedValue ( { } ) ;
369
313
370
314
await scaffold ( options ) ;
371
315
372
- expect ( liftGit ) . toHaveBeenCalledWith ( { projectRoot : projectPath , vcs : vcsOriginDetails } ) ;
316
+ expect ( liftGit ) . toHaveBeenCalledWith ( { projectRoot : projectPath , vcs} ) ;
373
317
expect ( scaffoldReadme ) . toHaveBeenCalledWith ( { projectName, projectRoot : projectPath , description} ) ;
374
318
expect ( execa ) . not . toHaveBeenCalled ( ) ;
375
319
} ) ;
@@ -378,7 +322,7 @@ describe('project scaffolder', () => {
378
322
when ( optionsValidator . validate ) . calledWith ( options ) . mockReturnValue ( { plugins : { languages} } ) ;
379
323
prompts . promptForBaseDetails . mockResolvedValue ( { } ) ;
380
324
languagePrompt . default . mockResolvedValue ( { [ questionNames . PROJECT_LANGUAGE ] : projectLanguage } ) ;
381
- scaffoldGit . mockResolvedValue ( { } ) ;
325
+ scaffoldGit . mockResolvedValue ( vcsResults ) ;
382
326
383
327
await scaffold ( options ) ;
384
328
@@ -390,7 +334,7 @@ describe('project scaffolder', () => {
390
334
description : undefined ,
391
335
projectName : undefined ,
392
336
projectRoot : projectPath ,
393
- vcs : { } ,
337
+ vcs,
394
338
visibility : undefined
395
339
}
396
340
) ;
0 commit comments