Comments (3)
Additional error logs -
tsc --noEmit --project tsconfig.jest.json
node_modules/@types/sinon/node_modules/@sinonjs/fake-timers/types/fake-timers-src.d.ts:11:28 - error TS2304: Cannot find name 'queueMicrotask'.
11 queueMicrotask: typeof queueMicrotask;
test/cognito.test.ts:11:32 - error TS2345: Argument of type 'typeof CognitoIdentityProviderClient' is not assignable to parameter of type 'InstanceOrClassType<Client<ServiceInputTypes, MetadataBearer, any>>'.
Type 'typeof CognitoIdentityProviderClient' is not assignable to type 'ClassType<Client<ServiceInputTypes, MetadataBearer, any>>'.
The types of 'prototype.middlewareStack.concat' are incompatible between these types.
Type '<InputType extends ServiceInputTypes, OutputType extends ServiceOutputTypes>(from: MiddlewareStack<InputType, OutputType>) => MiddlewareStack<InputType, OutputType>' is not assignable to type '<InputType extends ServiceInputTypes, OutputType extends MetadataBearer>(from: MiddlewareStack<InputType, OutputType>) => MiddlewareStack<InputType, OutputType>'.
Types of parameters 'from' and 'from' are incompatible.
Type 'MiddlewareStack<InputType, OutputType>' is not assignable to type 'MiddlewareStack<InputType, ServiceOutputTypes>'.
Types of property 'addRelativeTo' are incompatible.
Type '(middleware: MiddlewareType<InputType, OutputType>, options: RelativeMiddlewareOptions) => void' is not assignable to type '(middleware: MiddlewareType<InputType, ServiceOutputTypes>, options: RelativeMiddlewareOptions) => void'.
Types of parameters 'middleware' and 'middleware' are incompatible.
Type 'MiddlewareType<InputType, ServiceOutputTypes>' is not assignable to type 'MiddlewareType<InputType, OutputType>'.
Type 'InitializeMiddleware<InputType, ServiceOutputTypes>' is not assignable to type 'MiddlewareType<InputType, OutputType>'.
Type 'InitializeMiddleware<InputType, ServiceOutputTypes>' is not assignable to type 'InitializeMiddleware<InputType, OutputType>'.
Call signature return types 'InitializeHandler<InputType, ServiceOutputTypes>' and 'InitializeHandler<InputType, OutputType>' are incompatible.
Type 'Promise<InitializeHandlerOutput<ServiceOutputTypes>>' is not assignable to type 'Promise<InitializeHandlerOutput<OutputType>>'.
Type 'InitializeHandlerOutput<ServiceOutputTypes>' is not assignable to type 'InitializeHandlerOutput<OutputType>'.
Types of property 'output' are incompatible.
Type 'ServiceOutputTypes' is not assignable to type 'OutputType'.
'ServiceOutputTypes' is assignable to the constraint of type 'OutputType', but 'OutputType' could be instantiated with a different subtype of constraint 'MetadataBearer'.
Type 'AddCustomAttributesCommandOutput' is not assignable to type 'OutputType'.
'AddCustomAttributesCommandOutput' is assignable to the constraint of type 'OutputType', but 'OutputType' could be instantiated with a different subtype of constraint 'MetadataBearer'.
11 const cognitoMock = mockClient(CognitoIdentityProviderClient)
test/cognito.test.ts:13:16 - error TS2345: Argument of type 'typeof AdminInitiateAuthCommand' is not assignable to parameter of type 'new (input: AdminInitiateAuthCommandInput) => AwsCommand<AdminInitiateAuthCommandInput, MetadataBearer, any, any>'.
Types of construct signatures are incompatible.
Type 'new (input: AdminInitiateAuthCommandInput) => AdminInitiateAuthCommand' is not assignable to type 'new (input: AdminInitiateAuthCommandInput) => AwsCommand<AdminInitiateAuthCommandInput, MetadataBearer, any, any>'.
Construct signature return types 'AdminInitiateAuthCommand' and 'AwsCommand<AdminInitiateAuthCommandInput, MetadataBearer, any, any>' are incompatible.
The types of 'middlewareStack.concat' are incompatible between these types.
Type '<InputType extends AdminInitiateAuthCommandInput, OutputType extends AdminInitiateAuthCommandOutput>(from: MiddlewareStack<InputType, OutputType>) => MiddlewareStack<...>' is not assignable to type '<InputType extends AdminInitiateAuthCommandInput, OutputType extends MetadataBearer>(from: MiddlewareStack<InputType, OutputType>) => MiddlewareStack<...>'.
Types of parameters 'from' and 'from' are incompatible.
Type 'MiddlewareStack<InputType, OutputType>' is not assignable to type 'MiddlewareStack<InputType, AdminInitiateAuthCommandOutput>'.
Types of property 'addRelativeTo' are incompatible.
Type '(middleware: MiddlewareType<InputType, OutputType>, options: RelativeMiddlewareOptions) => void' is not assignable to type '(middleware: MiddlewareType<InputType, AdminInitiateAuthCommandOutput>, options: RelativeMiddlewareOptions) => void'.
Types of parameters 'middleware' and 'middleware' are incompatible.
Type 'MiddlewareType<InputType, AdminInitiateAuthCommandOutput>' is not assignable to type 'MiddlewareType<InputType, OutputType>'.
Type 'InitializeMiddleware<InputType, AdminInitiateAuthCommandOutput>' is not assignable to type 'MiddlewareType<InputType, OutputType>'.
Type 'InitializeMiddleware<InputType, AdminInitiateAuthCommandOutput>' is not assignable to type 'InitializeMiddleware<InputType, OutputType>'.
Call signature return types 'InitializeHandler<InputType, AdminInitiateAuthCommandOutput>' and 'InitializeHandler<InputType, OutputType>' are incompatible.
Type 'Promise<InitializeHandlerOutput<AdminInitiateAuthCommandOutput>>' is not assignable to type 'Promise<InitializeHandlerOutput<OutputType>>'.
Type 'InitializeHandlerOutput<AdminInitiateAuthCommandOutput>' is not assignable to type 'InitializeHandlerOutput<OutputType>'.
Types of property 'output' are incompatible.
Type 'AdminInitiateAuthCommandOutput' is not assignable to type 'OutputType'.
'AdminInitiateAuthCommandOutput' is assignable to the constraint of type 'OutputType', but 'OutputType' could be instantiated with a different subtype of constraint 'MetadataBearer'.
13 cognitoMock.on(AdminInitiateAuthCommand).resolves({
On further investigation I think this issue could be related to sinonjs/fake-timers#387 (comment)
As per the suggestions in the above issue, I also used sinonjs/fake-timers@6 and @types/sinonjs__fake-timers@6 to test if older dependencies would resolve this issue.
However I still encounter the same error.
from aws-sdk-client-mock.
Hey,
please check with yarn why @aws-sdk/types
(or something similar for npm) if you have different versions of @aws-sdk/types
installed. It may be that you are using, let's say, @aws-sdk/types 3.20.0
, but you also have installed the amplify library that has dependency on the @aws-sdk/types v3.10.0
. yarn (or npm) can decide that on the root level of node_modules it will install the v3.10.0. Then in the tests the types don't match, because you are trying to mock v3.20.0 client while the mocking library sees the types for the v3.10.0.
If that's the case, the resolution for this is to force the yarn (or npm) to install the same version of @aws-sdk/types
as the other @aws-sdk/client-*
you have. In yarn, you can do this with:
"resolutions": {
"@aws-sdk/types": "3.18.0"
},
in package.json.
Let me know if that helps.
Unfortunately, there is nothing we can do about that problem on the library side.
I need to add this info to the readme.
from aws-sdk-client-mock.
Hey, did the above help you? If not, please also take a look at #28
I'm closing this for now, but please let me know if the problem remains.
from aws-sdk-client-mock.
Related Issues (20)
- not compatible with "@aws-sdk/xxx": "3.451.0" HOT 5
- Deprecated [email protected] library
- Solution to types not compatible with @aws-sdk/* version 3.xxx.x
- Support `toHaveReceivedAnyCommand` HOT 1
- Add repository object/homepage key to package.json HOT 2
- Fail to stub entirely QueryCommand - DynamoDB HOT 2
- Testing SDK Retries HOT 3
- Upload throws error when using mocked S3 client HOT 3
- Types is not working for aws-sdk 3.362.0 HOT 4
- AwsStub issues HOT 3
- SQSClient received matching "DeleteMessageCommand" 0 times, after "SendMessageCommand" is run HOT 1
- NodeJS 20 mocking Upload doesn't work HOT 1
- Question: how to list/print configured client beheviours? HOT 1
- calls() does not return calls made from exception handler HOT 1
- 3.1.0 / 4.0.0 breaks existing test-suite/build with Invalid Chai property: toHaveReceivedCommandWith on vitest HOT 3
- Asymmetric Matchers not working HOT 4
- Jest matcher expect().toEqual() throws error "TypeError: this.customTesters is not iterable" HOT 4
- s3 mock: You are trying to `import` a file after the Jest environment has been torn down. HOT 2
- Documentation for callsFake() should provide an example of returning Promise.reject() HOT 1
- Mocked ECSClient (using mockClient(ECSClient)) is not assignable to parameter of type 'ECSClient' HOT 10
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from aws-sdk-client-mock.