@@ -346,7 +346,6 @@ describe('applying environments', async () => {
346346 test ( testName , async ( ) => {
347347 testResult = { }
348348 testError = undefined
349-
350349 await inTemporaryDirectory ( async ( tmpDir ) => {
351350 await writeFile ( joinPath ( tmpDir , 'shopify.environments.toml' ) , encodeTOML ( allEnvironments as any ) )
352351 await testFunc ( tmpDir )
@@ -603,6 +602,32 @@ describe('applying environments', async () => {
603602 } ,
604603 )
605604
605+ runTestInTmpDir ( 'provides --no-input to commands through the global flags' , async ( tmpDir : string ) => {
606+ // When
607+ await MockCommand . run ( [ '--path' , tmpDir , '--no-input' ] )
608+
609+ // Then
610+ expect ( testError ) . toBeUndefined ( )
611+ expect ( testResult [ 'no-input' ] ) . toBe ( true )
612+ } )
613+
614+ runTestInTmpDir ( 'treats disabled input as non-interactive in a TTY' , async ( tmpDir : string ) => {
615+ // When
616+ vi . stubEnv ( 'SHOPIFY_FLAG_NO_INPUT' , 'true' )
617+ await MockCommandWithRequiredFlagInNonTTY . run ( [ '--path' , tmpDir , '--no-input' ] )
618+
619+ // Then
620+ expect ( unstyled ( testError ! . message ) ) . toMatch ( 'Flag not specified:\n\n--nonTTYRequiredFlag' )
621+ } )
622+
623+ runTestInTmpDir ( 'supports disabling input through the environment' , async ( tmpDir : string ) => {
624+ vi . stubEnv ( 'SHOPIFY_FLAG_NO_INPUT' , 'true' )
625+
626+ await MockCommandWithRequiredFlagInNonTTY . run ( [ '--path' , tmpDir ] )
627+
628+ expect ( unstyled ( testError ! . message ) ) . toMatch ( 'Flag not specified:\n\n--nonTTYRequiredFlag' )
629+ } )
630+
606631 runTestInTmpDir ( 'does not throw in TTY mode when a non-TTY required argument is missing' , async ( tmpDir : string ) => {
607632 // Given — simulate interactive terminal
608633 Object . defineProperty ( process . stdin , 'isTTY' , { value : true , configurable : true , writable : true } )
@@ -627,6 +652,14 @@ describe('applying environments', async () => {
627652 expect ( unstyled ( testError ! . message ) ) . toMatch ( 'Flag not specified:\n\n--nonTTYRequiredFlag' )
628653 } )
629654
655+ runTestInTmpDir ( 'treats piped stdin as non-interactive' , async ( tmpDir : string ) => {
656+ Object . defineProperty ( process . stdin , 'isTTY' , { value : false , configurable : true , writable : true } )
657+
658+ await MockCommandWithRequiredFlagInNonTTY . run ( [ '--path' , tmpDir ] )
659+
660+ expect ( unstyled ( testError ! . message ) ) . toMatch ( 'Flag not specified:\n\n--nonTTYRequiredFlag' )
661+ } )
662+
630663 runTestInTmpDir ( 'reports all missing declarative non-TTY requirements' , async ( tmpDir : string ) => {
631664 // Given
632665 vi . stubEnv ( 'CI' , 'true' )
0 commit comments