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

'Unexpected token export' error when using vue-icon in Jest unit testing #2

Open
ghost opened this issue May 11, 2018 · 2 comments
Open

Comments

@ghost
Copy link

ghost commented May 11, 2018

Version

2.0.0

Steps to reproduce

<v-icon v-if="item.icon" v-bind:name="item.icon"></v-icon>
  • Running the following test:
import Vue from 'vue'
import { mount } from '@vue/test-utils'

import router from '@/router'
import VueI18n from 'vue-i18n'
import Vuelidate from 'vuelidate'
import BootstrapVue from 'bootstrap-vue'
import feather from 'vue-icon'

import DropdownIcon from '@/components/molecules/DropdownIcon'

describe('DropdownIcon', () => {

    const wrapper = mount(DropdownIcon)
    const vm = wrapper.vm

    it('should be a Vue instance', () => {
        expect(wrapper.isVueInstance()).toBeTruthy()
    })

})

What is expected

vue-icon is imported and used in component - so component can be tested correctly.

What is actually happening

 FAIL  test\unit\specs\DropdownIcon.spec.js
  ● Test suite failed to run

    C:\Users\User\Development\project_name\node_modules\vue-icon\lib\vue-feather-plugin.esm.js:133
    export default install;
    ^^^^^^

    SyntaxError: Unexpected token export

       6 | import Vuelidate from 'vuelidate'
       7 | import BootstrapVue from 'bootstrap-vue'
    >  8 | import feather from 'vue-icon'
       9 |
      10 | import DropdownIcon from '@/components/molecules/DropdownIcon'
      11 |

      at ScriptTransformer._transformAndBuildScript (node_modules/jest-runtime/build/script_transformer.js:316:17)
      at Object.<anonymous> (test/unit/specs/DropdownIcon.spec.js:8:16)

Other information

When I run npm run dev the code compiles and builds out correctly, and vue-icon works as intended.
I only get this problem when I run npm run unit.

My other tests on components which don't use vue-icon work as intended. I believe this has something to do with vue-icon using uncompiled ES6 code? Please correct me if I'm wrong.

Thank you for your time!

@qinshenxue
Copy link
Owner

thanks for your feedback. I will fix the problem as soon as possible.

@bitsnaps
Copy link

Looks like this project is no longer maintained, I'm not sure if it's support Vue 3, the best icon package -IMO- for Vue at the moment is @iconify/vue by far.

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

2 participants