Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Does not play well with Jest: template or render function not defined. #45

Open
scheepers opened this issue Apr 9, 2021 · 0 comments
Open

Comments

@scheepers
Copy link

scheepers commented Apr 9, 2021

Current behavior

Whenever testing a component that includes a vue-tel-input-vuetify component, the following error is logged while running test cases:

 PASS  src/components/fields/HePassword.test.js
 PASS  src/components/fields/HePhone.test.js
  ● Console

    console.error node_modules/vue/dist/vue.runtime.common.dev.js:621
      [Vue warn]: Failed to mount component: template or render function not defined.
      
      found in
      
      ---> <VueTelInputVuetify>
             <Anonymous>
               <Root>


Test Suites: 2 passed, 2 total
Tests:       6 passed, 6 total
Snapshots:   0 total
Time:        1.722s
Ran all test suites.

Expected behavior

No errors (other than test cases failing) should be logged.

Versions

Libraries:

{
  ...
  "dependencies": {
    "@koumoul/vjsf": "^1.24.1",
    "@mdi/font": "^5.9.55",
    "@mdi/js": "^5.9.55",
    "ajv": "^8.0.1",
    "axios": "^0.21.1",
    "core-js": "^3.6.5",
    "json-pointer": "^0.6.1",
    "ol": "^6.4.3",
    "vue": "^2.6.11",
    "vue-axios": "^3.2.2",
    "vue-inline-svg": "^2.0.0",
    "vue-router": "^3.2.0",
    "vue-tel-input-vuetify": "^1.2.15",
    "vuetify": "^2.2.11"
  },
  "devDependencies": {
    "@vue/cli-plugin-babel": "~4.5.0",
    "@vue/cli-plugin-eslint": "~4.5.0",
    "@vue/cli-plugin-router": "^4.5.9",
    "@vue/cli-plugin-unit-jest": "^4.5.9",
    "@vue/cli-service": "~4.5.0",
    "@vue/test-utils": "^1.1.2",
    "babel-eslint": "^10.1.0",
    "eslint": "^6.7.2",
    "eslint-plugin-vue": "^6.2.2",
    "jsdoc": "^3.6.6",
    "jsdoc-vuejs": "^3.0.9",
    "minami": "^1.2.3",
    "node-sass": "^5.0.0",
    "sass": "^1.19.0",
    "sass-loader": "^8.0.2",
    "vue-cli-plugin-vuetify": "~2.0.8",
    "vue-template-compiler": "^2.6.12",
    "vuetify-loader": "^1.3.0"
  }
  ...
}

Environment:

  • Device: MacBook Pro
  • OS: kubuntu 18.04
  • Browser: n/a
  • Browser Version: n/a

Additional context

Basic unit tests seem to pass:

import { mount } from '@vue/test-utils'
import Phone from './HePhone.vue'

describe('Phone',
  () => {

    const phone = mount(Phone);

    // Component basics

    test('Is a Vue instance',
      () => expect(phone.isVueInstance).toBeTruthy()
    )

    test('Has no data function',
      () => expect(typeof phone.data).toBe('undefined')
    )

    test('Has a props function',
      () => expect(typeof phone.props).toBe('function')
    )

    // Component specific tests

    expect(phone.html()).toContain(' ')

  }
)

With test setup:

import Vue from 'vue'
import VueRouter from 'vue-router'
import Vuetify from 'vuetify'
import VueTelInputVuetify from 'vue-tel-input-vuetify'

Vue.use(VueRouter)
Vue.use(Vuetify)
Vue.use(VueTelInputVuetify, { Vuetify })

Vue.component('vue-tel-input-vuetify', VueTelInputVuetify)
@scheepers scheepers changed the title Does not play well with Jest Does not play well with Jest: template or render function not defined. Apr 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant