jest tip

YEONGHUN KO·2023년 8월 3일
0

JAVASCRIPT TESTING

목록 보기
9/11
post-thumbnail

짜잘하게 알아낸 jest 문법, 설정방법 등등 알아낸것을 적는 공간

debugging

screen.debug()

// dom 이 터미널에 나타난다.

module not found

path alias 를 설정시 tsconfig 뿐만 아니라 jsconfig / babelrc 에도 설정해주어야 함

An object should only be passed to the image component src parameter if it comes from a static image import.

image path를 import하지 말고 image src에 string으로 그대로 적으면 됨

tobeinthedocument not a function

import "@testing-library/jest-dom";
를 선언해주면 해결

서버 응답

  • nock이라는걸 쓰면 간단하게 mocking가능

custom hook

  • renderHook을 사용하면 간단하게 mocking가능
profile
'과연 이게 최선일까?' 끊임없이 생각하기

1개의 댓글

comment-user-thumbnail
2023년 8월 3일

개발자로서 성장하는 데 큰 도움이 된 글이었습니다. 감사합니다.

답글 달기