programing

vue-test-utils 및 joke에서 $nuxt 개체를 조롱하는 방법

prostudy 2022. 8. 8. 15:09
반응형

vue-test-utils 및 joke에서 $nuxt 개체를 조롱하는 방법

코드를 테스트하기 위해 vue-test-utils와 joke를 사용하고 있습니다.아래 코드를 통과하지 않는 한 문제없이 테스트 실행

$nuxt.$store.commit("device/saveState", {
      id: this.$.id,
      key: this.$.ac_key,
      power: this.$.ac_power,
      mode: this.$.ac_mode,
      temp: this.$.ac_temp,
      wind: this.$.ac_wind
    })

그리고 그것은 나에게 이 오류를 줄 것이다.

 [Vue warn]: Error in created hook: "ReferenceError: $nuxt is not defined"

언급URL : https://stackoverflow.com/questions/62403239/how-to-mock-nuxt-object-in-vue-test-utils-and-jest

반응형