kentcdodds/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!
기타 프로젝트측정된 스타 증가
- in 24h
- 0
- in 7 days
- 0
- in 15 days
- 0
- in 1 month
- 기록 수집 중
서로 겹치는 기간의 순증가량이며 일별 합계가 아닙니다. 측정값이 없으면 비워 둡니다. 스타는 관심도를 나타내며 품질을 보장하지 않습니다.
README.md
OriginalHow 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.

관련 프로젝트 살펴보기
불러오는 중…