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.

Extract mocked function in a different package

See original GitHub issue

Hello 👋

I have been using babel to compile my typescript projects more and more lately, and the only reason why I am still installing ts-jest is because of the utils/mocked function.

Would you consider extracting this util into its own package?

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:10 (4 by maintainers)

github_iconTop GitHub Comments

3reactions
SimenBcommented, Apr 12, 2019

Yeah, works for me! Looks useful

2reactions
dylangcommented, Apr 12, 2019

Would it be worth proposing to the Jest team to add it to the core package, especially now that Jest is written in TypeScript, or to https://github.com/jest-community?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Mock only one function from module but leave rest with ...
mock ('package-name') makes all exported functions mocks, which I don't want. I tried spreading the named exports back into the mock object...
Read more >
Mock Functions - Jest
Mock functions allow you to test the links between code by erasing the actual implementation of a function, capturing calls to the function...
Read more >
How to mock specific module function? · Issue #936 - GitHub
I have a module. It exports multiple functions. Here is myModule.js: export function foo() {...} export function b...
Read more >
Mocking different values for the same module using Jest
We've seen how to mock a module to export different values for different tests. When the export is a function, you can mock...
Read more >
How To Mock Only One Function From A Module In Jest
I had a similar case where I was importing several different exports from a module @module/api and using it throughout my code. In...
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