All Projects → kentcdodds → How Jest Mocking Works

kentcdodds / How Jest Mocking Works

Programming Languages

javascript
184084 projects - #8 most used programming language

Labels

Projects that are alternatives of or similar to How Jest Mocking Works

Simply React
Stars: ✭ 101 (-56.28%)
Mutual labels:  kcd-edu
Bookshelf
Build a ReactJS App workshop
Stars: ✭ 2,179 (+843.29%)
Mutual labels:  kcd-edu
React Jest Workshop
Stars: ✭ 193 (-16.45%)
Mutual labels:  kcd-edu
React Hooks
Learn React Hooks! 🎣 ⚛
Stars: ✭ 1,988 (+760.61%)
Mutual labels:  kcd-edu
React Hooks And Suspense Egghead Playlist
This is the code for the egghead playlist "React Hooks and Suspense"
Stars: ✭ 128 (-44.59%)
Mutual labels:  kcd-edu
Js Mocking Fundamentals
JavaScript Mocking Fundamentals on TestingJavaScript.com
Stars: ✭ 182 (-21.21%)
Mutual labels:  kcd-edu
Advanced React Hooks
Learn Advanced React Hooks workshop
Stars: ✭ 1,208 (+422.94%)
Mutual labels:  kcd-edu
Modern React
workshop about React's hottest new features in 16.7.0
Stars: ✭ 210 (-9.09%)
Mutual labels:  kcd-edu
Static Testing Tools
Static Analysis Testing JavaScript Applications on TestingJavaScript.com
Stars: ✭ 141 (-38.96%)
Mutual labels:  kcd-edu
React Ava Workshop
🐯 A workshop repository for testing React ⚛ with AVA 🚀 --> slides
Stars: ✭ 192 (-16.88%)
Mutual labels:  kcd-edu
Advanced React Patterns V2
Created with CodeSandbox
Stars: ✭ 1,495 (+547.19%)
Mutual labels:  kcd-edu
Modern Javascript
Get up to speed on the latest, most useful JavaScript features to level up your programming
Stars: ✭ 123 (-46.75%)
Mutual labels:  kcd-edu
The Beginner S Guide To Reactjs
The beginner's Guide to ReactJS course material for Egghead.io
Stars: ✭ 185 (-19.91%)
Mutual labels:  kcd-edu
App Dev Tools
An example of how to create and hook up App DevTools to improve your development productivity of your application
Stars: ✭ 102 (-55.84%)
Mutual labels:  kcd-edu
React Github Profile
Stars: ✭ 198 (-14.29%)
Mutual labels:  kcd-edu
Testing Workshop
A workshop for learning how to test JavaScript applications
Stars: ✭ 1,276 (+452.38%)
Mutual labels:  kcd-edu
Dom Testing Library With Anything
Use DOM Testing Library to test any JS framework on TestingJavaScript.com
Stars: ✭ 177 (-23.38%)
Mutual labels:  kcd-edu
Express App Example
How I structure Express Apps (example repo)
Stars: ✭ 222 (-3.9%)
Mutual labels:  kcd-edu
Learn React
Learn React with a laser focused, guided approach.
Stars: ✭ 204 (-11.69%)
Mutual labels:  kcd-edu
React Fundamentals
Material for my React Fundamentals Workshop
Stars: ✭ 3,247 (+1305.63%)
Mutual labels:  kcd-edu

How Jest Mocking Works

This title is a bit misleading. I'm not explaining everything about Jest mocking, just something I wanted to test out and thought was kind of interesting. So it turns out that if you make a call to jest.mock in the root of your module, that mocking will take place before any require statements are resolved/run. This actually makes Jest's mocking capabilities really powerful! It essentially means that you can import all the stuff you would normally, and not worry about whether you're mocking things in time. Pretty legit!

And Christoph comes in to give a little more insight here :) Looks like you can use jest.doMock or jest.dontMock to change this behavior.

tweets

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].