@@ -35,7 +35,7 @@ describe("slackme", async () => {
35
35
expect ( exec . exitCode ) . toBe ( 0 ) ;
36
36
exec = await execContainer ( id , [ "sh" , "-c" , "slackme" ] ) ;
37
37
expect ( exec . stdout . trim ( ) ) . toStartWith (
38
- "slackme — Send a Slack notification when a command finishes" ,
38
+ "slackme — Send a Slack notification when a command finishes"
39
39
) ;
40
40
} ) ;
41
41
@@ -56,6 +56,15 @@ describe("slackme", async () => {
56
56
} ) ;
57
57
} ) ;
58
58
59
+ it ( "exits with command code" , async ( ) => {
60
+ const { instance, id } = await setupContainer ( ) ;
61
+ await writeCoder ( id , "echo 'some-url' && exit 1" ) ;
62
+ let exec = await execContainer ( id , [ "sh" , "-c" , instance . script ] ) ;
63
+ expect ( exec . exitCode ) . toBe ( 0 ) ;
64
+ exec = await execContainer ( id , [ "sh" , "-c" , "slackme exit 1" ] ) ;
65
+ expect ( exec . exitCode ) . toBe ( 1 ) ;
66
+ } ) ;
67
+
59
68
it ( "formats multiline message" , async ( ) => {
60
69
await assertSlackMessage ( {
61
70
command : "echo test" ,
@@ -107,7 +116,7 @@ executed`,
107
116
108
117
const setupContainer = async (
109
118
image = "alpine" ,
110
- vars : Record < string , string > = { } ,
119
+ vars : Record < string , string > = { }
111
120
) => {
112
121
const state = await runTerraformApply ( import . meta. dir , {
113
122
agent_id : "foo" ,
@@ -150,7 +159,7 @@ const assertSlackMessage = async (opts: {
150
159
"alpine/curl" ,
151
160
opts . format && {
152
161
slack_message : opts . format ,
153
- } ,
162
+ }
154
163
) ;
155
164
await writeCoder ( id , "echo 'token'" ) ;
156
165
let exec = await execContainer ( id , [ "sh" , "-c" , instance . script ] ) ;
0 commit comments