vuejs / vue-jest

Jest Vue transformer
MIT License
742 stars 159 forks source link

Upgrade TS target to ES6 #538

Open ruojianll opened 1 year ago

ruojianll commented 1 year ago

If a third package exported a ES6 native class, and a class in .vue file extends it. When calling super in constructor, get error TypeError: Class constructors cannot be invoked without 'new'.

Transformed classes (in ES5)) from .vue files are not compatible with native classes (in ES6) exported by third packages.

ES6 is also vue3 basic environment, so should we upgrade it?

https://github.com/vuejs/vue-jest/blob/master/packages/vue3-jest/lib/utils.js#L116

windsurfing33 commented 1 year ago

That would be very useful for me :)

rhianvanesch commented 10 months ago

I've also been running into this issue, and it seems the problem is unfortunately more complex than just changing the target: https://github.com/vuejs/vue-jest/issues/445#issuecomment-1121714802. It is possible to add "downLevelIteratiion": true to your tsconfig.json's compilerOptions, but this will affect your production code as well.

stephdz commented 10 months ago

It would be useful for us too. vue-jest is incompatible with facing-dev/vue-facing-decorator so we are stuck with deprecated vue-property-decorator and vue-class-component.