schlechtenburg/test/with-setup.ts
2024-10-09 14:43:40 +02:00

15 lines
366 B
TypeScript

import { mount } from '@vue/test-utils';
import { defineComponent, Component } from 'vue'
export async function withSetup<T>(composable: () => T): Promise<T> {
return new Promise((resolve) => {
mount(defineComponent({
setup() {
resolve(composable());
// suppress missing template warning
return () => {}
}
}));
});
}