diff --git a/packages/credential-provider-node/src/credential-provider-node.integ.spec.ts b/packages/credential-provider-node/src/credential-provider-node.integ.spec.ts index 650a5f0421b1..624b42f7bde4 100644 --- a/packages/credential-provider-node/src/credential-provider-node.integ.spec.ts +++ b/packages/credential-provider-node/src/credential-provider-node.integ.spec.ts @@ -68,14 +68,16 @@ jest.mock("@aws-sdk/client-sso", () => { }; }); -let stsSpy: jest.Spied | any | undefined = undefined; +// This var must be hoisted. +// eslint-disable-next-line no-var +var stsSpy: jest.Spied | any | undefined = undefined; jest.mock("@aws-sdk/client-sts", () => { const actual = jest.requireActual("@aws-sdk/client-sts"); const originalSend = actual.STSClient.prototype.send; - stsSpy = jest.spyOn(actual.STSClient.prototype, "send").mockImplementation(async function (command: any) { + stsSpy = jest.spyOn(actual.STSClient.prototype, "send").mockImplementation(async function (this: any, command: any) { if (command.constructor.name === "AssumeRoleCommand") { return { Credentials: { diff --git a/packages/middleware-eventstream/src/middleware-eventstream.integ.spec.ts b/packages/middleware-eventstream/src/middleware-eventstream.integ.spec.ts index 1097489941d2..3861c94804c4 100644 --- a/packages/middleware-eventstream/src/middleware-eventstream.integ.spec.ts +++ b/packages/middleware-eventstream/src/middleware-eventstream.integ.spec.ts @@ -26,7 +26,7 @@ describe("middleware-eventstream", () => { [Symbol.asyncIterator]() { return { next() { - return this; + return this as any; }, }; }, @@ -57,7 +57,7 @@ describe("middleware-eventstream", () => { [Symbol.asyncIterator]() { return { next() { - return this; + return this as any; }, }; }, @@ -87,7 +87,7 @@ describe("middleware-eventstream", () => { [Symbol.asyncIterator]() { return { next() { - return this; + return this as any; }, }; }, diff --git a/packages/middleware-sdk-sqs/src/middleware-sdk-sqs.integ.spec.ts b/packages/middleware-sdk-sqs/src/middleware-sdk-sqs.integ.spec.ts index 8d84f628e135..7a6b7b714894 100644 --- a/packages/middleware-sdk-sqs/src/middleware-sdk-sqs.integ.spec.ts +++ b/packages/middleware-sdk-sqs/src/middleware-sdk-sqs.integ.spec.ts @@ -4,8 +4,9 @@ import type { AwsCredentialIdentity } from "@smithy/types"; import crypto from "crypto"; import { Readable } from "stream"; -import sqsModel from "../../../codegen/sdk-codegen/aws-models/sqs.json"; import { requireRequestsFrom } from "../../../private/aws-util-test/src"; + +const sqsModel: any = require("../../../codegen/sdk-codegen/aws-models/sqs.json"); const useAwsQuery = !!sqsModel.shapes["com.amazonaws.sqs#AmazonSQS"].traits["aws.protocols#awsQuery"]; let hashError = ""; diff --git a/packages/middleware-sdk-transcribe-streaming/src/middleware-sdk-transcribe-streaming.integ.spec.ts b/packages/middleware-sdk-transcribe-streaming/src/middleware-sdk-transcribe-streaming.integ.spec.ts index f3df6db66796..af595d18996f 100644 --- a/packages/middleware-sdk-transcribe-streaming/src/middleware-sdk-transcribe-streaming.integ.spec.ts +++ b/packages/middleware-sdk-transcribe-streaming/src/middleware-sdk-transcribe-streaming.integ.spec.ts @@ -42,7 +42,7 @@ describe("middleware-sdk-transcribe-streaming", () => { MediaEncoding: "pcm", AudioStream: { [Symbol.asyncIterator]() { - return this; + return this as any; }, }, }); diff --git a/packages/middleware-websocket/src/middleware-websocket.integ.spec.ts b/packages/middleware-websocket/src/middleware-websocket.integ.spec.ts index e776cf8e5b92..fe7e82abbe93 100644 --- a/packages/middleware-websocket/src/middleware-websocket.integ.spec.ts +++ b/packages/middleware-websocket/src/middleware-websocket.integ.spec.ts @@ -41,7 +41,7 @@ describe("middleware-websocket", () => { ChallengeVersions: "a,b,c", LivenessRequestStream: { [Symbol.asyncIterator]() { - return this; + return this as any; }, }, });