Skip to content
This repository was archived by the owner on Dec 9, 2024. It is now read-only.

Commit c79e27f

Browse files
medikootbarlow12
authored andcommitted
fix: Crash deployment if function app zip file doesn't exist (#242)
1 parent 327511c commit c79e27f

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

src/plugins/deploy/azureDeployPlugin.test.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,4 +64,10 @@ describe("Deploy plugin", () => {
6464
expect(ResourceService.prototype.listDeployments).toBeCalled();
6565
expect(sls.cli.log).lastCalledWith(deploymentString);
6666
});
67+
68+
it("crashes deploy if zip file is not found", async () => {
69+
FunctionAppService.prototype.getFunctionZipFile = jest.fn(() => "notExisting.zip");
70+
await expect(invokeHook(plugin, "deploy:deploy"))
71+
.rejects.toThrow(/Function app zip file '.*' does not exist/)
72+
});
6773
});

src/plugins/deploy/azureDeployPlugin.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,7 @@ export class AzureDeployPlugin extends AzureBasePlugin<AzureLoginOptions> {
5656
const functionAppService = new FunctionAppService(this.serverless, this.options);
5757
const zipFile = functionAppService.getFunctionZipFile();
5858
if (!fs.existsSync(zipFile)) {
59-
this.log(`Function app zip file '${zipFile}' does not exist`);
60-
return Promise.resolve();
59+
throw new Error(`Function app zip file '${zipFile}' does not exist`);
6160
}
6261
await resourceService.deployResourceGroup();
6362
const functionApp = await functionAppService.deploy();

0 commit comments

Comments
 (0)