Skip to content

Commit 0434166

Browse files
Update Dependencies (#182)
* update dependencies * Update code formatting * Use jest legacy timers * Rollback mock-fs version to node 10 compatible version * Add explicit axios dependency Co-authored-by: DarcyRaynerDD <[email protected]> Co-authored-by: DarcyRaynerDD <[email protected]>
1 parent 1f8c116 commit 0434166

File tree

11 files changed

+807
-2028
lines changed

11 files changed

+807
-2028
lines changed

integration_tests/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
"author": "",
1111
"license": "ISC",
1212
"dependencies": {
13+
"axios": "0.21.1",
1314
"datadog-lambda-js": "^3.27.0"
1415
},
1516
"devDependencies": {

package.json

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,25 +17,25 @@
1717
"postbuild": "scripts/update_dist_version.sh"
1818
},
1919
"devDependencies": {
20-
"@types/aws-lambda": "^8.10.75",
20+
"@types/aws-lambda": "^8.10.76",
2121
"@types/aws-sdk": "^2.7.0",
22-
"@types/jest": "^26.0.22",
22+
"@types/jest": "^26.0.23",
2323
"@types/mock-fs": "4.13.0",
2424
"@types/nock": "^11.1.0",
25-
"@types/node": "^14.14.41",
25+
"@types/node": "^15.6.1",
2626
"@types/promise-retry": "^1.1.3",
2727
"@types/shimmer": "^1.0.1",
28-
"dd-trace": "0.32.1",
29-
"jest": "^26.6.3",
30-
"mock-fs": "4.13.0",
28+
"dd-trace": "0.33.2",
29+
"jest": "^27.0.1",
30+
"mock-fs": "4.14.0",
3131
"nock": "13.0.11",
32-
"prettier": "^2.2.1",
33-
"ts-jest": "^26.5.5",
32+
"prettier": "^2.3.0",
33+
"ts-jest": "^27.0.1",
3434
"tslint": "^6.1.3",
35-
"typescript": "^4.2.4"
35+
"typescript": "^4.3.2"
3636
},
3737
"dependencies": {
38-
"aws-xray-sdk-core": "^3.3.1",
38+
"aws-xray-sdk-core": "^3.3.3",
3939
"bignumber.js": "^9.0.1",
4040
"hot-shots": "8.3.1",
4141
"promise-retry": "^2.0.1",

src/index.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ const mockedIncrementErrors = incrementErrorsMetric as jest.Mock<typeof incremen
1818
const mockedIncrementInvocations = incrementInvocationsMetric as jest.Mock<typeof incrementInvocationsMetric>;
1919

2020
const mockARN = "arn:aws:lambda:us-east-1:123497598159:function:my-test-lambda";
21-
const mockContext = ({
21+
const mockContext = {
2222
invokedFunctionArn: mockARN,
23-
} as any) as Context;
23+
} as any as Context;
2424

2525
// const MockedListener = OriginalListenerModule.MetricsListener as jest.Mocked<
2626
// typeof OriginalListenerModule.MetricsListener

src/metrics/enhanced-metrics.spec.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,15 @@ jest.mock("../utils/process-version");
88
const mockedGetProcessVersion = getProcessVersion as jest.Mock<string>;
99

1010
const mockARN = "arn:aws:lambda:us-east-1:123497598159:function:my-test-lambda";
11-
const mockContext = ({
11+
const mockContext = {
1212
invokedFunctionArn: mockARN,
1313
memoryLimitInMB: "128",
14-
} as any) as Context;
15-
const mockContextLocal = ({
14+
} as any as Context;
15+
const mockContextLocal = {
1616
functionName: "my-test-lambda",
1717
functionVersion: "1.0.0",
1818
memoryLimitInMB: "128",
19-
} as any) as Context;
19+
} as any as Context;
2020

2121
describe("getRuntimeTag", () => {
2222
it("returns a null runtime tag when version is not recognized", () => {

src/metrics/listener.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ describe("MetricsListener", () => {
9292
shouldRetryMetrics: false,
9393
siteURL,
9494
});
95-
jest.useFakeTimers();
95+
jest.useFakeTimers("legacy");
9696

9797
listener.onStartInvocation({});
9898
listener.sendDistributionMetric("my-metric", 10, false, "tag:a", "tag:b");
@@ -125,7 +125,7 @@ describe("MetricsListener", () => {
125125
shouldRetryMetrics: false,
126126
siteURL,
127127
});
128-
jest.useFakeTimers();
128+
jest.useFakeTimers("legacy");
129129

130130
await listener.onStartInvocation({});
131131
listener.sendDistributionMetric("my-metric", 10, false, "tag:a", "tag:b");

src/metrics/processor.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { Client } from "./api";
44
import { APIMetric, Distribution, Metric } from "./model";
55
import { Processor } from "./processor";
66

7-
jest.useFakeTimers();
7+
jest.useFakeTimers("legacy");
88

99
class MockAPIClient implements Client {
1010
public metricCalls: APIMetric[][] = [];

src/trace/context.spec.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,7 @@ describe("readTraceFromHTTPEvent", () => {
324324

325325
describe("readTraceFromSQSEvent", () => {
326326
it("can read from sqs source", () => {
327-
const result = readTraceFromSQSEvent(({
327+
const result = readTraceFromSQSEvent({
328328
Records: [
329329
{
330330
body: "Hello world",
@@ -351,7 +351,7 @@ describe("readTraceFromSQSEvent", () => {
351351
receiptHandle: "x",
352352
},
353353
],
354-
} as unknown) as SQSEvent);
354+
} as unknown as SQSEvent);
355355
expect(result).toEqual({
356356
parentID: "3369753143434738315",
357357
sampleMode: SampleMode.AUTO_KEEP,
@@ -360,7 +360,7 @@ describe("readTraceFromSQSEvent", () => {
360360
});
361361
});
362362
it("can handle malformed JSON", () => {
363-
const result = readTraceFromSQSEvent(({
363+
const result = readTraceFromSQSEvent({
364364
Records: [
365365
{
366366
body: "Hello world",
@@ -387,7 +387,7 @@ describe("readTraceFromSQSEvent", () => {
387387
receiptHandle: "x",
388388
},
389389
],
390-
} as unknown) as SQSEvent);
390+
} as unknown as SQSEvent);
391391
expect(result).toBeUndefined();
392392
});
393393
});

src/trace/trigger.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ import { readFileSync } from "fs";
44
import { Context } from "aws-lambda";
55

66
const mockARN = "arn:aws:lambda:us-east-1:123456789012:function:test-nodejs-lambda";
7-
const mockContext = ({
7+
const mockContext = {
88
invokedFunctionArn: mockARN,
9-
} as any) as Context;
9+
} as any as Context;
1010

1111
describe("parseEventSource", () => {
1212
const events = [

src/utils/handler.spec.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ import { didFunctionColdStart } from "./cold-start";
44
import { wrap } from "./handler";
55
import { LogLevel, setLogLevel } from "./log";
66

7-
const mockContext = ({
7+
const mockContext = {
88
invokedFunctionArn: "arn:aws:lambda:us-east-1:123497598159:function:my-test-lambda",
9-
} as any) as Context;
9+
} as any as Context;
1010

1111
beforeEach(() => {
1212
setLogLevel(LogLevel.NONE);
@@ -215,7 +215,7 @@ describe("wrap", () => {
215215
setTimeout(() => {
216216
callback(null, { statusCode: 204, body: "The callback response" });
217217
}, 10);
218-
return ({ statusCode: 200, body: "The promise response" } as unknown) as void;
218+
return { statusCode: 200, body: "The promise response" } as unknown as void;
219219
};
220220

221221
let calledOriginalHandler = false;

src/utils/timer.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { Timer } from "./timer";
22

3-
jest.useFakeTimers();
3+
jest.useFakeTimers("legacy");
44

55
describe("Timer", () => {
66
it("should return on a regular interval", async () => {

0 commit comments

Comments
 (0)