@@ -265,6 +265,42 @@ describe.runIf(process.platform === "darwin")("create-dmg ownership boundaries",
265265 expect ( readFileSync ( tools . hdiutilLog , "utf8" ) ) . not . toContain ( "detach" ) ;
266266 } ) ;
267267
268+ it ( "fails before image creation when Finder layout values are malformed" , ( ) => {
269+ const app = makeValidApp ( ) ;
270+ const outputDir = mkdtempSync ( path . join ( tmpdir ( ) , "openclaw-create-dmg-output-" ) ) ;
271+ tempDirs . push ( outputDir ) ;
272+ const output = path . join ( outputDir , "OpenClaw.dmg" ) ;
273+ const tools = makeFakeDmgTools ( ) ;
274+
275+ const result = runScript ( [ app , output ] , {
276+ ...tools . env ,
277+ DMG_WINDOW_BOUNDS : "400 nope 900 420" ,
278+ } ) ;
279+
280+ expect ( result . status ) . toBe ( 1 ) ;
281+ expect ( result . stderr ) . toContain ( "DMG_WINDOW_BOUNDS must contain only integer values" ) ;
282+ expect ( existsSync ( output ) ) . toBe ( false ) ;
283+ expect ( existsSync ( tools . hdiutilLog ) ? readFileSync ( tools . hdiutilLog , "utf8" ) : "" ) . toBe ( "" ) ;
284+ } ) ;
285+
286+ it ( "fails before image creation when Finder layout values span multiple lines" , ( ) => {
287+ const app = makeValidApp ( ) ;
288+ const outputDir = mkdtempSync ( path . join ( tmpdir ( ) , "openclaw-create-dmg-output-" ) ) ;
289+ tempDirs . push ( outputDir ) ;
290+ const output = path . join ( outputDir , "OpenClaw.dmg" ) ;
291+ const tools = makeFakeDmgTools ( ) ;
292+
293+ const result = runScript ( [ app , output ] , {
294+ ...tools . env ,
295+ DMG_WINDOW_BOUNDS : "400 100 900 420\nnope" ,
296+ } ) ;
297+
298+ expect ( result . status ) . toBe ( 1 ) ;
299+ expect ( result . stderr ) . toContain ( "DMG_WINDOW_BOUNDS must be a single line" ) ;
300+ expect ( existsSync ( output ) ) . toBe ( false ) ;
301+ expect ( existsSync ( tools . hdiutilLog ) ? readFileSync ( tools . hdiutilLog , "utf8" ) : "" ) . toBe ( "" ) ;
302+ } ) ;
303+
268304 it ( "preserves an existing output when verification fails" , ( ) => {
269305 const app = makeValidApp ( ) ;
270306 const outputDir = mkdtempSync ( path . join ( tmpdir ( ) , "openclaw-create-dmg-output-" ) ) ;
0 commit comments