vuejs / vue-jest

Jest Vue transformer
MIT License
746 stars 157 forks source link

feat: support TS with script setup #402

Closed beneee closed 2 years ago

beneee commented 2 years ago

Automatic TypeScript detection and passing of the isTS option was introduced with the pull request #394. Unfortunately that change was not enough to make this also work for components that utilize <script setup>.

The Vue plugin for Vite checks both the descriptor.scriptSetup.lang and the descriptor.script.lang field the check whether the given component is written in TypeScript: https://github.com/vitejs/vite/blob/b17b5ae68de50413a95fb992ceda92ec0fceaa86/packages/plugin-vue/src/template.ts#L164

This commit enables the same behavior for script setup components by additionally checking the descriptor.scriptSetup.lang property.