import ma = require ( 'azure-pipelines-task-lib/mock-answer' ) ; import tmrm = require ( 'azure-pipelines-task-lib/mock-run' ) ; import path = require ( 'path' ) ; let tp = path . join ( __dirname , './GCPApplyFailInvalidWorkingDirectoryL0.js' ) ; let tr = new tmrm . TaskMockRunner ( tp ) ; tr . setInput ( 'provider' , 'gcp' ) ; tr . setInput ( 'command' , 'apply' ) ; tr . setInput ( 'workingDirectory' , 'DummyWorkingDirectory' ) ; tr . setInput ( 'environmentServiceNameGCP' , 'GCP' ) ; tr . setInput ( 'commandOptions' , '' ) ; process . env [ 'ENDPOINT_AUTH_SCHEME_GCP' ] = 'Jwt' ; process . env [ 'ENDPOINT_DATA_GCP_PROJECT' ] = 'DummyProject' ; process . env [ 'ENDPOINT_AUTH_PARAMETER_GCP_ISSUER' ] = 'Dummyissuer' ; process . env [ 'ENDPOINT_AUTH_PARAMETER_GCP_AUDIENCE' ] = 'DummyAudience' ; process . env [ 'ENDPOINT_AUTH_PARAMETER_GCP_PRIVATEKEY' ] = 'DummyPrivateKey' ; process . env [ 'ENDPOINT_AUTH_PARAMETER_GCP_SCOPE' ] = 'DummyScope' ; let a = < ma . TaskLibAnswers > { "which" : { "terraform" : "terraform" } , "checkPath" : { "terraform" : true } , "exec" : { "terraform providers" : { "code" : 0 , "stdout" : "Executed successfully" } , "terraform validate" : { "code" : 1 , "stdout" : "Execution failed: invalid config files" } , "terraform apply -auto-approve" : { "code" : 1 , "stdout" : "Execution failed: invalid config files" } } } ; tr . setAnswers ( a ) ; tr . run ( ) ;