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

Improve error handling #156

Open
sktzofrenic opened this issue Feb 6, 2019 · 3 comments
Open

Improve error handling #156

sktzofrenic opened this issue Feb 6, 2019 · 3 comments

Comments

@sktzofrenic
Copy link

Here is the error I'm getting:

    [vue-jest] Error: Vue template compilation failed

      1 | import { shallowMount } from '@vue/test-utils'
    > 2 | import Problem from './../../src/components/Problem.vue'
        | ^
      3 |
      4 | describe('Problem.vue', () => {
      5 |     it('initializes and sets up correctly', () => {

      at error (node_modules/vue-jest/lib/throw-error.js:2:9)
      at Object.<anonymous> (tests/unit/problem.spec.js:2:1)

Please see this git repo for reproduction:

https://github.com/sktzofrenic/jest-problem

run

$ cd hello-world
$ npm run test:unit

This is basically a vanilla vue-cli project with one added component that is generating this issue.

I cannot figure out what won't compile about this template.

When I build for production it compiles just fine and this component works on the live site. I just can't test it for some reason.

I would appreciate any assistance. Thank you!

@sktzofrenic
Copy link
Author

This was my mistake as it was almost impossible for me to see, but there were two class attributes on one dom element and the compiler was correctly telling me this was wrong. Two things that are still confusing:

  1. Why did vue-jest not tell me where the error was? That is a possible improvement and would have saved a lot of time. Instead it just told me the import statement was where the error was.
  2. Why does the production vue-template-compiler compile this without warnings or errors?

Thanks

@eddyerburgh eddyerburgh changed the title [vue-jest] Error: Vue template compilation failed [vue-jest] Improve error handling Feb 8, 2019
@eddyerburgh eddyerburgh changed the title [vue-jest] Improve error handling Improve error handling Feb 8, 2019
@OrkhanAlikhanov
Copy link

#170 (comment) was the solution in my case

@rrd108
Copy link

rrd108 commented Oct 19, 2021

in my case the problem was an inline emit call

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants