Unit-Testing-Vue2 icon indicating copy to clipboard operation
Unit-Testing-Vue2 copied to clipboard

Error: Cannot read property 'text' of undefined

Open bitsnaps opened this issue 5 years ago • 2 comments

Hi, I get an error when testing FlushPromises :

Cannot read property 'text' of undefined

The app is working fine, it runs correctly, I've even added a line to display <MessageDisplay /> in the AppHeader.vue to make sure the json-server is up and running. The beginning of the log:

    console.error node_modules/vue/dist/vue.runtime.common.dev.js:621
      [Vue warn]: Error in render: "TypeError: Cannot read property 'text' of undefined"

      found in

      ---> <Anonymous>
             <Root>
    console.error node_modules/vue/dist/vue.runtime.common.dev.js:1884
      TypeError: Cannot read property 'text' of undefined

bitsnaps avatar Apr 17 '20 07:04 bitsnaps

Same here

skoyah avatar May 04 '20 17:05 skoyah

Hi. I've added this code after jest.mock() call: beforeEach(() => { jest.clearAllMocks(); //todo don't forget to clear all mocks before each test! }) and it seemed to clear that error.

edytajordan avatar Dec 16 '21 13:12 edytajordan