Grace
grace's dev_note
Grace
전체 방문자
오늘
어제
  • 분류 전체보기
    • FrontEnd
      • Next.js
      • React
      • ReactNativ..
      • Vue
    • Javascript
      • 러닝 자바스크립트
      • 모던 자바스크립트
    • CS
    • DataScienc..
      • Data Struc..
      • LeetCode
    • BackEnd
      • Express
      • Node.js
      • Nest.js
    • DevOps
      • Docker
    • 매일메일
    • 회고
    • 코드캠프

블로그 메뉴

  • 홈
  • 태그
  • 방명록

공지사항

인기 글

태그

  • postgres
  • backend
  • Vue3
  • vue-query
  • tanstack
  • 함수
  • Vite
  • Express
  • 자바스크립트
  • vitejs
  • Vue
  • 번들러
  • PostgreSQL
  • node.js
  • javascript
  • 알고리즘
  • pinia
  • React Native
  • Vue.js
  • nest.js

최근 댓글

최근 글

티스토리

hELLO · Designed By 정상우.
Grace

grace's dev_note

[vue3/jest] 🚫에러 일지 - TypeError: Cannot set properties of undefined (setting 'hasOwnProperty')
FrontEnd/Vue

[vue3/jest] 🚫에러 일지 - TypeError: Cannot set properties of undefined (setting 'hasOwnProperty')

2023. 2. 7. 14:52

지난 게시글에 이어 진행됩니다.
두 가지 에러를 모두 핸들링 해주고 났는데도 불구하고 또 다른 에러가 저의 테스트를 막습니다(...)
제발 테스트 하게 해줘!

TypeError: Cannot set properties of undefined (setting 'hasOwnProperty')

이번에 만난 에러는 이런 에러입니다. 각 컴포넌트를 가져오려고하는데 가져오지 못하는걸까? shallowMount 에서 에러가 발생했는데 컴포넌트가 undefined 인 것 처럼 보여서 뭔가 컴포넌트를 인식을 못하는걸까? 해서 틸드 기호로 가져오던 import 도 상대 경로로 수정해보고 파일 확장자를 지정해주지 않아서일까 해서 파일 확장자도 지정해주었는데도 불구하고 에러가 계속해서 발생했습니다.
여러 구글링을 진행해본 결과 이것 또한 별거 아닌 문제이긴 했는데요...
관련 stackoverflow 글입니다.
https://stackoverflow.com/questions/72616277/cannot-create-component-with-shallowmount-vm-refsvtu-component-is-not-defi

 

Cannot create component with shallowMount, vm.$refs['VTU_COMPONENT'] is not defined

Not sure if it is a bug or If I'm doing something wrong. I try to mount my main App component with shallowMount but it doesn't works. I get the following error message: Cannot set properties of

stackoverflow.com

글을 읽어보시면 아시겠지만 정말로 저와 똑같은!!! 에러를 가지고 계셨더라구요!!!
그래서 답을 확인해보았더니


아... ㅎㅎㅎ
package.json에서 확인한 저의 @vue/test-utils 버전은 2.0.0-rc.18 이였습니다.
해당 버전을 업그레이드 해주도록 합시다

yarn add --dev @vue/test-utils@2.0.0-rc.21

시간이 조금 지나고 버전 업그레이드가 완료되면 다시 테스트를 돌려봅시다

드디어 초록색 pass 창을 만났습니다 :)
jest를 드디어 마무리 했습니다!

저작자표시 비영리 변경금지 (새창열림)

'FrontEnd > Vue' 카테고리의 다른 글

[Vue3] Setup hook  (0) 2023.04.02
[Vue3] Composition API  (0) 2023.04.02
[Vue 3] 빠르게 정리하기  (0) 2023.02.20
[vue3/jest] 🚫에러 일지 - ReferenceError: location is not defined, ReferenceError: document is not defined  (0) 2023.02.07
[vue3/jest] 🚫에러 일지 - Jest encountered an unexpected token  (0) 2023.02.07
    'FrontEnd/Vue' 카테고리의 다른 글
    • [Vue3] Composition API
    • [Vue 3] 빠르게 정리하기
    • [vue3/jest] 🚫에러 일지 - ReferenceError: location is not defined, ReferenceError: document is not defined
    • [vue3/jest] 🚫에러 일지 - Jest encountered an unexpected token
    Grace
    Grace
    기술 및 회고 블로그

    티스토리툴바