블로그 이미지

Gicomong (Lux)

  • 분류 전체보기
    • 개발 기술
      • 사소하지만 놓치기 쉬운 개발 지식
      • css 애니메이션 (with js)
      • 개발 이야기
      • jest로 테스트하자
      • 함수형 프로그래밍
      • 타입스크립트
    • 사용자의 접근성 높이는 방법
      • W3C 기준
    • 조직 문화
    • 이번엔 이 공부 끝내겠다 시리즈
      • 테스트코드
      • github actions
      • 정규표현식
    • 라이브러리 파헤치기
    • error log
    • 주저리
Visits

Mong dev blog

  • 관리
  • 글쓰기
  • 방명록
  • 로그인
  • 로그아웃

modal.setappelement(el) to make this accessible1

[Vitest] Error: You must set an element with Modal.setAppElement(el) to make this accessible
1. 현상(1) 에러 발생Vitest 환경에서 ReactModal 테스트 구동시 발생한다.[에러 로그]Error: You must set an element with Modal.setAppElement(el) to make this accessiblesetAppElement throws error in testsWarning: react-modal: App element is not defined(2) 해결 방법테스트 대상 모달 컴포넌트에서 NODE_ENV 조건문을 추가한다.// beforeReactModal.setAppElement('#root');// after - 테스트 환경에서 setAppElement를 실행치 않도록 변경if (process.env.NODE_ENV !== 'test') React..
2024. 7. 14.
이전 1 다음

티스토리툴바