aws-solutions / qnabot-on-aws

AWS QnABot is a multi-channel, multi-language conversational interface (chatbot) that responds to your customer's questions, answers, and feedback. The solution allows you to deploy a fully functional chatbot across multiple channels including chat, voice, SMS and Amazon Alexa.
https://aws.amazon.com/solutions/implementations/aws-qnabot
Apache License 2.0
401 stars 253 forks source link

Include aws-sdk-client-mock-jest as a dependency #740

Closed amendlik closed 5 months ago

amendlik commented 5 months ago

This enables individual Jest test to be run, without running the entire test suite.

Issue #, if available: N/A

Description of changes: Include aws-sdk-client-mock-jest as a dependency in the development environment. This enables individual Jest tests to be run without running the entire suite.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

abhirpat commented 5 months ago

@amendlik Thank you for your submission. You can run individual test suitea in each directory after install dev dependencies in that directory npm i --dev since it is listed under devDependencies. You could do that with:

cd source/lambda/fulfillment 
npm i --dev
npm test                                                          (all test suites in dir)
npm test npm test test/lib/middleware/multilanguage.test.js       (single test suite in dir)

Have you tried it this way? Please let me me know if still issue in any test suite.

amendlik commented 5 months ago

I suppose that would work, but it raises the question of why the top-level dependencies include aws-sdk-client-mock. Why include one dependency but not another?

abhirpat commented 5 months ago

Are you reviewing 5.5.0 structure as it was when this PR was submitted? I'd recommend to pull new 6.0.0 changes. With 6.0.0, we have optimized and consolidated common AWS SDK dependencies to reduce overall solution artifact size and lambdas deployment package size. In main package.json, the few sdk dependencies that are listed are needed for building and deploying stack using npm run scripts and source/website. The aws-sdk-client-mock in main package.json is used for unit testing of website while aws-sdk-client-mock-jest is not being used in source/website.

We appreciate your effort and time for submitting PR. After careful review, we have decided not to consider it for merging into main 6.0.0. If you have any further questions or concerns, please feel free to let us know.