Skip to content

Commit dd0360a

Browse files
committed
fix: skip process.exit(1) in dry-run mode
The deploy e2e CI uses --dry-run with a dummy token, which causes StaticSitesClient to fail with BadRequest. In dry-run mode, binary failures should be logged but not cause process.exit(1). Added test: 'should not call process.exit(1) in dry-run mode'
1 parent 5a1fb49 commit dd0360a

2 files changed

Lines changed: 12 additions & 1 deletion

File tree

src/cli/commands/deploy/deploy.spec.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -260,5 +260,14 @@ describe("deploy", () => {
260260

261261
expect(exitSpy).not.toHaveBeenCalled();
262262
});
263+
264+
it("should not call process.exit(1) on non-zero exit code in dry-run mode", async () => {
265+
await deploy({ outputLocation: "/test-output", dryRun: true });
266+
267+
mockChild.emit("close", 1);
268+
269+
expect(logger.error).toHaveBeenCalledWith("The deployment binary exited with code 1.");
270+
expect(exitSpy).not.toHaveBeenCalled();
271+
});
263272
});
264273
});

src/cli/commands/deploy/deploy.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,9 @@ export async function deploy(options: SWACLIConfig) {
337337
logger.error(`The deployment binary exited with code ${code}.`);
338338
logger.error(`If you are running in a minimal container image, ensure native dependencies are installed.`);
339339
logger.error(`Run ${chalk.cyan(`ldd ${binary}`)} to check for missing shared libraries.`);
340-
process.exit(1);
340+
if (!dryRun) {
341+
process.exit(1);
342+
}
341343
}
342344
});
343345
}

0 commit comments

Comments
 (0)