Skip to content

Commit

Permalink
fix: Crash deployment if function app zip file doesn't exist (#242)
Browse files Browse the repository at this point in the history
  • Loading branch information
medikoo authored and tbarlow12 committed Aug 16, 2019
1 parent 327511c commit c79e27f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
6 changes: 6 additions & 0 deletions src/plugins/deploy/azureDeployPlugin.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,4 +64,10 @@ describe("Deploy plugin", () => {
expect(ResourceService.prototype.listDeployments).toBeCalled();
expect(sls.cli.log).lastCalledWith(deploymentString);
});

it("crashes deploy if zip file is not found", async () => {
FunctionAppService.prototype.getFunctionZipFile = jest.fn(() => "notExisting.zip");
await expect(invokeHook(plugin, "deploy:deploy"))
.rejects.toThrow(/Function app zip file '.*' does not exist/)
});
});
3 changes: 1 addition & 2 deletions src/plugins/deploy/azureDeployPlugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,7 @@ export class AzureDeployPlugin extends AzureBasePlugin<AzureLoginOptions> {
const functionAppService = new FunctionAppService(this.serverless, this.options);
const zipFile = functionAppService.getFunctionZipFile();
if (!fs.existsSync(zipFile)) {
this.log(`Function app zip file '${zipFile}' does not exist`);
return Promise.resolve();
throw new Error(`Function app zip file '${zipFile}' does not exist`);
}
await resourceService.deployResourceGroup();
const functionApp = await functionAppService.deploy();
Expand Down

0 comments on commit c79e27f

Please sign in to comment.