vendredi 29 septembre 2017

[Vue warn]: Error in render function: "TypeError: Cannot read property 'theme' of undefined"

I am building an app in Vuejs using the Quasar framework. Automated testing is required in the project. The problem is Quasar documentation isn't very specific when it comes to configure a testing environment. Now, I have tried to install karma and integrate it to the project however an error keeps popping up whenever I try to $mount a vue component:

[Vue warn]: Error in render function: "TypeError: Cannot read property 'theme' of undefined"

The following error happens when I try to karma start and run this simple test.

describe('Main.vue', () => {
  it('should render correct contents', () => {
    const vm = new Vue(Main).$mount()
    console.log(vm.$el)
    expect(vm.$el.querySelector('.hello h1').textContent).to.equal('Welcome to Your Vue.js App')
  })
})

My Main.vue component:

import Vue from 'vue'
import Quasar, * as All from 'quasar'
import router from './router'
import store from './store/index.js'

Quasar.start(() => {
  new Vue({
    el: '#app',
    router,
    store,
    render: h => h(require('./App'))
  })
})

Has anyone ever experienced this issue and knows how to solve it? The versions I am using are "quasar-framework": "^0.14.1", "vue": "~2.3.4"and "karma": "^1.4.1".

Aucun commentaire:

Enregistrer un commentaire