mocking aws-sdk fails with moduleName.split is not a function
See original GitHub issueDo you want to request a feature or report a bug? bug What is the current behavior? The following code
test("aws fail", () => {
const awsMock = jest.genMockFromModule("aws-sdk");
jest.mock(awsMock);
});
throws
TypeError: moduleName.split is not a function
** steps to reproduce ** The presented code is all that is needed
What is the expected behavior? That the mock actually works and the call does not crash
Please provide your exact Jest configuration and mention your Jest, node, yarn/npm version and operating system.
jest 22.4.2 aws-sdk 2.202.0 yarn 1.5.1 node 9.6.1
Issue Analytics
- State:
- Created 6 years ago
- Reactions:1
- Comments:5
Top Results From Across the Web
jestjs - jest.mock(..) not working in 'describe' (TypeError
The error you're getting TypeError: moduleName.split is not a function is because resolveModuleFromDirIfExists tries to split the module ...
Read more >mocking aws-sdk fails with moduleName.split is not a function
Coming soon: A brand new website interface for an even better experience!
Read more >Testing Firebase function with Jest – error : moduleName.split ...
I am trying to test a Firebase Cloud function using the firebase-functions-test SDK… The documentation ( as often) is based on mocha/sinon, ...
Read more >Mocking modular AWS SDK for JavaScript (v3) in Unit Tests
Example code to be tested. We have a function that takes an array of user IDs, finds the user information for each user...
Read more >Developing on AWS with C# - Awsstatic
Amazon S3 can do this not only because it contains near ... machine may cost more money than an event-driven AWS Lambda function...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@dfrkp could you please share your solution?
jest.mock('aws-sdk')