mercredi 4 avril 2018

Jest fail when i use booostrap-vue select

I create a new vue project and install jest and etc. After that i install bootstrap-vue(npm package) and jest fail with error: Test suite failed to run

...\node_modules\bootstrap-vue\es\components\form-select\form-select.js:1 ({"Object.":function(module,exports,require,__dirname,__filename,global,jest){import idMixin from '../../mixins/id'; ^^^^^^

My vue file:

<template>
  <div class="hello">
    <h1></h1>
    <b-select v-model="selected" :options="options">
    </b-select>
  </div>
</template>

<script>

import BSelect from '../../node_modules/bootstrap-vue/es/components/form-select/form-select'

export default {
  name: 'HelloWorld',
  data () {
    return {
      msg: 'Hellow word',
      selected: null,
      options: [
        { value: null, text: 'Please select an option' },
        { value: 'a', text: 'This is First option' },
        { value: 'b', text: 'Selected Option' },
        { value: {'C': '3PO'}, text: 'This is an option with object value' },
        { value: 'd', text: 'This one is disabled', disabled: true }
      ]
    }
  },
  components: {
    'b-select': BSelect
  }
}
</script>

My test file is default test:

import Vue from 'vue'
import HelloWorld from '@/components/HelloWorld'

    describe('HelloWorld.vue', () => {
      it('should render correct contents', () => {
        const Constructor = Vue.extend(HelloWorld)
        const vm = new Constructor().$mount()
        expect(vm.$el.querySelector('.hello h1').textContent)
          .toEqual('Hellow word')
      })
    })

Aucun commentaire:

Enregistrer un commentaire