Skip to content

Commit

Permalink
Merge pull request #55 from getlift/update-dependencies
Browse files Browse the repository at this point in the history
Update dependencies
  • Loading branch information
mnapoli authored Jun 23, 2021
2 parents 87184f8 + 90d4b3c commit 2665d5b
Show file tree
Hide file tree
Showing 10 changed files with 13,652 additions and 12,220 deletions.
25,811 changes: 13,619 additions & 12,192 deletions package-lock.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"tslib": "^1.13.0"
},
"devDependencies": {
"@serverless/test": "^7.11.0",
"@serverless/test": "^8.2.0",
"@serverless/typescript": "^2.35.0",
"@types/chai": "^4.2.12",
"@types/jest": "^26.0.22",
Expand Down
7 changes: 6 additions & 1 deletion src/classes/AwsProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,12 @@ export class AwsProvider {
}

addFunction(functionName: string, functionConfig: unknown): void {
Object.assign(this.serverless.service.functions, {
if (!this.serverless.configurationInput.functions) {
// If serverless.yml does not contain any functions, bootstrapping a new empty functions config
this.serverless.configurationInput.functions = {};
}

Object.assign(this.serverless.configurationInput.functions, {
[functionName]: functionConfig,
});
}
Expand Down
10 changes: 5 additions & 5 deletions test/unit/common.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ describe("common", () => {
const { cfTemplate } = await runServerless({
fixture: "common",
configExt: pluginConfigExt,
cliArgs: ["package"],
command: "package",
});
expect(cfTemplate.Resources).toMatchObject({
UserDefinedResource: {},
Expand All @@ -16,7 +16,7 @@ describe("common", () => {
it("should validate construct configuration", async () => {
// Valid config: should not throw
await runServerless({
cliArgs: ["package"],
command: "package",
config: Object.assign(baseConfig, {
constructs: {
avatars: {
Expand All @@ -28,7 +28,7 @@ describe("common", () => {
// Invalid config: invalid property
await expect(
runServerless({
cliArgs: ["package"],
command: "package",
config: Object.assign(baseConfig, {
constructs: {
avatars: {
Expand All @@ -42,7 +42,7 @@ describe("common", () => {
// Invalid config: valid property, but in the wrong construct
await expect(
runServerless({
cliArgs: ["package"],
command: "package",
config: Object.assign(baseConfig, {
constructs: {
avatars: {
Expand All @@ -53,7 +53,7 @@ describe("common", () => {
},
}),
})
).rejects.toThrow("Configuration error at 'constructs.avatars': unsupported configuration format");
).rejects.toThrow("Configuration error at 'constructs.avatars': unsupported value");
});

it("should resolve variables", async () => {
Expand Down
8 changes: 4 additions & 4 deletions test/unit/permissions.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ describe("permissions", () => {
},
},
}),
cliArgs: ["package"],
command: "package",
});
expect(cfTemplate.Resources.FooLambdaFunction).toMatchObject({
Properties: {
Expand All @@ -65,7 +65,7 @@ describe("permissions", () => {
},
},
}),
cliArgs: ["package"],
command: "package",
});

expectUserDynamoStatementIsAdded(cfTemplate);
Expand All @@ -86,7 +86,7 @@ describe("permissions", () => {
],
},
}),
cliArgs: ["package"],
command: "package",
});

expectUserDynamoStatementIsAdded(cfTemplate);
Expand All @@ -97,7 +97,7 @@ describe("permissions", () => {
const { cfTemplate } = await runServerless({
fixture: "permissions",
configExt: pluginConfigExt,
cliArgs: ["package"],
command: "package",
});

expectLiftStorageStatementIsAdded(cfTemplate);
Expand Down
16 changes: 8 additions & 8 deletions test/unit/queues.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ describe("queues", () => {
const { cfTemplate, computeLogicalId } = await runServerless({
fixture: "queues",
configExt: pluginConfigExt,
cliArgs: ["package"],
command: "package",
});
expect(Object.keys(cfTemplate.Resources)).toStrictEqual([
"ServerlessDeploymentBucket",
Expand Down Expand Up @@ -138,7 +138,7 @@ describe("queues", () => {
},
},
}),
cliArgs: ["package"],
command: "package",
});
expect(cfTemplate.Resources[computeLogicalId("emails", "Queue")]).toMatchObject({
Properties: {
Expand All @@ -162,7 +162,7 @@ describe("queues", () => {
},
},
}),
cliArgs: ["package"],
command: "package",
});
expect(cfTemplate.Resources[computeLogicalId("emails", "Queue")]).toMatchObject({
Properties: {
Expand All @@ -183,7 +183,7 @@ describe("queues", () => {
},
},
}),
cliArgs: ["package"],
command: "package",
});
expect(cfTemplate.Resources.EmailsWorkerEventSourceMappingSQSEmailsQueueF057328A).toMatchObject({
Properties: {
Expand All @@ -202,7 +202,7 @@ describe("queues", () => {
},
},
}),
cliArgs: ["package"],
command: "package",
});
expect(Object.keys(cfTemplate.Resources)).toStrictEqual([
"ServerlessDeploymentBucket",
Expand Down Expand Up @@ -271,7 +271,7 @@ describe("queues", () => {
await runServerless({
fixture: "queues",
configExt: pluginConfigExt,
cliArgs: ["emails:failed:purge"],
command: "emails:failed:purge",
});

expect(purgeSpy.firstCall.firstArg).toStrictEqual({
Expand All @@ -291,7 +291,7 @@ describe("queues", () => {
await runServerless({
fixture: "queues",
configExt: pluginConfigExt,
cliArgs: ["emails:failed:retry"],
command: "emails:failed:retry",
});

expect(sendSpy.callCount).toBe(0);
Expand Down Expand Up @@ -345,7 +345,7 @@ describe("queues", () => {
await runServerless({
fixture: "queues",
configExt: pluginConfigExt,
cliArgs: ["emails:failed:retry"],
command: "emails:failed:retry",
});

// The failed message should have been "sent" to the main queue
Expand Down
10 changes: 5 additions & 5 deletions test/unit/staticWebsites.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ describe("static websites", () => {

it("should create all required resources", async () => {
const { cfTemplate, computeLogicalId } = await runServerless({
cliArgs: ["package"],
command: "package",
config: Object.assign(baseConfig, {
constructs: {
landing: {
Expand Down Expand Up @@ -183,7 +183,7 @@ describe("static websites", () => {

it("should support a custom domain", async () => {
const { cfTemplate, computeLogicalId } = await runServerless({
cliArgs: ["package"],
command: "package",
config: Object.assign(baseConfig, {
constructs: {
landing: {
Expand Down Expand Up @@ -229,7 +229,7 @@ describe("static websites", () => {

it("should support multiple custom domains", async () => {
const { cfTemplate, computeLogicalId } = await runServerless({
cliArgs: ["package"],
command: "package",
config: Object.assign(baseConfig, {
constructs: {
landing: {
Expand Down Expand Up @@ -269,7 +269,7 @@ describe("static websites", () => {

it("should allow to customize security HTTP headers", async () => {
const { cfTemplate, computeLogicalId } = await runServerless({
cliArgs: ["package"],
command: "package",
config: Object.assign(baseConfig, {
constructs: {
landing: {
Expand Down Expand Up @@ -336,7 +336,7 @@ describe("static websites", () => {
await runServerless({
fixture: "staticWebsites",
configExt: pluginConfigExt,
cliArgs: ["landing:upload"],
command: "landing:upload",
});

// scripts.js and styles.css were updated
Expand Down
2 changes: 1 addition & 1 deletion test/unit/storage.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ describe("storage", () => {
const { cfTemplate, computeLogicalId } = await runServerless({
fixture: "storage",
configExt: pluginConfigExt,
cliArgs: ["package"],
command: "package",
});
expect(cfTemplate.Resources[computeLogicalId("avatars", "Bucket")]).toMatchObject({
Type: "AWS::S3::Bucket",
Expand Down
4 changes: 2 additions & 2 deletions test/unit/webhooks.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ describe("webhooks", () => {
const { cfTemplate, computeLogicalId } = await runServerless({
fixture: "webhooks",
configExt: pluginConfigExt,
cliArgs: ["package"],
command: "package",
});
expect(cfTemplate.Resources[computeLogicalId("stripe", "Route")]).toMatchObject({
Properties: {
Expand All @@ -17,7 +17,7 @@ describe("webhooks", () => {
const { cfTemplate, computeLogicalId } = await runServerless({
fixture: "webhooksInsecure",
configExt: pluginConfigExt,
cliArgs: ["package"],
command: "package",
});
expect(cfTemplate.Resources[computeLogicalId("github", "Route")]).toMatchObject({
Properties: {
Expand Down
2 changes: 1 addition & 1 deletion test/utils/@serverless__test.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ declare module "@serverless/test/run-serverless" {
import type { AWS } from "@serverless/typescript";

type RunServerlessBaseOptions = Partial<{
cliArgs: string[];
command: string;
configExt: Partial<AWS> | Record<string, unknown>;
env: Record<string, string>;
awsRequestStubMap: unknwon;
Expand Down

0 comments on commit 2665d5b

Please sign in to comment.