[jest μ—λŸ¬πŸ”¨ ] testing Animated.View for React-Native app

HELLO WORLDπŸ™ŒΒ·2020λ…„ 7μ›” 21일
0

errorπŸ”¨

λͺ©λ‘ 보기
1/4

μ• λ‹ˆλ©”μ΄μ…˜μ΄ λ“€μ–΄κ°„ View μ»΄ν¬λ„ŒνŠΈλ₯Ό ν…ŒμŠ€νŒ…ν•˜λŠ”λ° 이 μ—λŸ¬κ°€ λ°œμƒν•œλ‹€..

ReferenceError: You are trying to `import` a file after the Jest environment has been torn down

해결방법

jest.useFakeTimers();

we enable fake timers by calling jest.useFakeTimers();. This mocks out setTimeout and other timer functions with mock functions. If running multiple tests inside of one file or describe block, jest.useFakeTimers(); can be called before each test manually or with a setup function such as beforeEach. Not doing so will result in the internal usage counter not being reset.
(beforeEachλŠ” ν…ŒμŠ€νŠΈκ°€ μ‹€ν–‰λ˜κΈ° 전에 μ΄ˆκΈ°ν™” μ‹œμΌœμ£ΌλŠ” κΈ°λŠ₯을 ν•œλ‹€.)

https://jestjs.io/docs/en/timer-mocks

0개의 λŒ“κΈ€