question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Problems with "Manual Mocks" docs page

See original GitHub issue

The Manual Mocks docs page has a few problems.

  • Although it clearly explains the directory structure for how to add a mock version of one of your own modules (e.g. models/user.js and models/__mocks__/user.js), it does not give any example of what that mock file’s contents should look like.
    • Needs an example on how to mock your own CommonJS module. I’m guessing this will look similar to the example for mocking a built-in module, but not sure.
    • Also needs an example on how to mock your own ES6 module with default exports and named exports. Does this look different from mocking a CommonJS module? Do you need to mock the default export like module.exports.default = ..., or can you use export default ...? An example showing the canonical, recommended approach is needed.
  • The section “Using with ES module imports” links off to this repo to explain how things work with ES6 import/export statements. But that repo does not contain a single example of an import/export statement, so it’s unclear what the reader is supposed to be looking for.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:8 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
nanomosfetcommented, Dec 9, 2018

@rickhanlonii Great! i’ll get a PR in as soon as it is ready:) thank you

Edit: thanks for the patience in this. Have been working with non-computer stuff recently:) This is still on my agenda 💯 12/9/2018

0reactions
github-actions[bot]commented, May 2, 2022

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Manual Mocks - Jest
One downside to fully manual mocks is that they're manual – meaning you have to manually update them any time the module they...
Read more >
Manual mocking using __mocks__ not working - Stack Overflow
I went through jest documentation for manual mocking and tried creating mocks folder as instructed. Please find the folder structure below. app ...
Read more >
"Manual Mocks" docs page does not address manual ... - GitHub
Bug Report When using named imports the documentation for providing a manual mock isn't super clear. Given a setup like: // sound-player.js ...
Read more >
How To Do Manual Mock In Jest Unit Testing | by Kris Ma
Jest has two ways to mock functions: Either by creating a mock function to use in test code or writing a manual mock...
Read more >
Jest Mocking Strategies | Mercedes Bernard
If you want to learn more, take a look at the Jest docs first ... To create a manual mock, we create a...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found