oku-ui/primitives

Vitest adds tsx support

Closed this issue · 5 comments

Additional context

Have you considered adding a jsx plug-in to Vitest? Tests will be easier to write.

import { defineConfig } from 'vitest/config'
import Vue from '@vitejs/plugin-vue'
import VueJsx from '@vitejs/plugin-vue-jsx'

export default defineConfig({
  plugins: [
     Vue(),
     VueJsx(),
  ],
})

Can you send a sample, Also if you want to write tests I can define a privilege for it in the project.

Thank you message

你能发送一个样本吗,如果你想写测试,我可以在项目中为它定义一个特权。您可以发送一个示例吗?如果您想编写测试,我可以在项目中为其定义权限。

感谢留言

I am using oku-ui primitives to create my own ui library, but the number of ui is relatively small. I want to help contribute some components, but I am not used to writing tests only in ts. I feel a bit tedious.

It might also be nice to put them in the component or core in tests folder and create a .vue there and then include the test. example radio-group folder

we can actually write .vue without the need for tsx. ? wouldn't that be better

<OkuRadioGroup default-value="1" class="root-class">
<OkuRadioGroupItem value="1" class="item-class">
<OkuRadioGroupIndicator class="indicator-class" />
</OkuRadioGroupItem>
<OkuRadioGroupItem value="2" class="item-class">
<OkuRadioGroupIndicator class="indicator-class" />
</OkuRadioGroupItem>
<OkuRadioGroupItem value="3" class="item-class">
<OkuRadioGroupIndicator class="indicator-class" />
</OkuRadioGroupItem>
</OkuRadioGroup>

Or you can use it this way, or you can write testComponent` as .vue in the tests folder, import it and duplicate the tests. I think we can go this way. what do you think about this

<OkuRadioGroup default-value="1" class="root-class">
<OkuRadioGroupItem value="1" class="item-class">
<OkuRadioGroupIndicator class="indicator-class" />
</OkuRadioGroupItem>
<OkuRadioGroupItem value="2" class="item-class">
<OkuRadioGroupIndicator class="indicator-class" />
</OkuRadioGroupItem>
<OkuRadioGroupItem value="3" class="item-class">
<OkuRadioGroupIndicator class="indicator-class" />
</OkuRadioGroupItem>
</OkuRadioGroup>

Or you can use it this way, or you can write testComponent` as .vue in the tests folder, import it and duplicate the tests. I think we can go this way. what do you think about this

I feel like your way of writing is enough, my question.