Subject of the issue
When running unit tests for Vue 2 SFC components with jest
via vue-test-utils
(+babel +typescript) the reported stack trace error line numbers are wrong.
Steps to reproduce
- Create a new Vue CLI project:
npx @vue/cli create repro-project

- Edit
HelloWorld.vue
component by adding a mounted() {}
lifecycle hook containing something like this:
mounted() {
this.iAmNotDefined = iAmNotDefineder
}
- Run
npm run test:unit
or pull my repro repo and run npm install && npm run test:unit
Expected behaviour
The correct line number is shown in the stack trace.
Actual behaviour
The opposite of the expected behaviour.
Possible Solution
My hunch says it's a transformation issue, but I've no idea if it's ts-jest
, vue-jest
, babel-js
or the sfc compiler.