@@ -415,7 +415,7 @@ async function runCommand() {
415415 await tuiTask ( {
416416 step : 9 ,
417417 title : 'Add scripts' ,
418- task : ( ) => {
418+ task : async ( ) => {
419419 const nestedPath = path . join ( OUTPUT_PROJECT_PATH , 'scripts' , 'one' , 'two' )
420420
421421 fs . mkdirSync ( nestedPath , { recursive : true } )
@@ -425,6 +425,57 @@ async function runCommand() {
425425 " console.log('Hello from myNestedScript.ts')\n" +
426426 '}\n\n' ,
427427 )
428+
429+ await exec (
430+ 'yarn rw g script i/am/nested' ,
431+ [ ] ,
432+ getExecaOptions ( OUTPUT_PROJECT_PATH ) ,
433+ )
434+
435+ // Verify that the scripts are added and included in the list of
436+ // available scripts
437+ const list = await exec (
438+ 'yarn rw exec' ,
439+ [ ] ,
440+ getExecaOptions ( OUTPUT_PROJECT_PATH ) ,
441+ )
442+
443+ if (
444+ ! list . stdout . includes ( 'seed' ) ||
445+ ! list . stdout . includes ( 'i/am/nested' ) ||
446+ ! list . stdout . includes ( 'one/two/myNestedScript' )
447+ ) {
448+ console . error ( 'yarn rw exec output' , list . stdout , list . stderr )
449+
450+ throw new Error ( 'Scripts not included in list' )
451+ }
452+
453+ // Verify that the scripts can be executed
454+ const runFromRoot = await exec (
455+ 'yarn rw exec one/two/myNestedScript' ,
456+ [ ] ,
457+ getExecaOptions ( OUTPUT_PROJECT_PATH ) ,
458+ )
459+
460+ if ( ! runFromRoot . stdout . includes ( 'Hello from myNestedScript' ) ) {
461+ console . error ( '`yarn rw exec one/two/myNestedScript` output' )
462+ console . error ( runFromRoot . stdout , runFromRoot . stderr )
463+
464+ throw new Error ( 'Script not executed successfully' )
465+ }
466+
467+ const runFromScripts = await exec (
468+ 'yarn rw exec one/two/myNestedScript' ,
469+ [ ] ,
470+ getExecaOptions ( path . join ( OUTPUT_PROJECT_PATH , 'scripts' , 'one' ) ) ,
471+ )
472+
473+ if ( ! runFromScripts . stdout . includes ( 'Hello from myNestedScript' ) ) {
474+ console . error ( '`yarn rw exec one/two/myNestedScript` output' )
475+ console . error ( runFromRoot . stdout , runFromRoot . stderr )
476+
477+ throw new Error ( 'Script not executed successfully' )
478+ }
428479 } ,
429480 } )
430481
0 commit comments