Files
ui/test/component-render.ts
Benjamin Canac d95556ebda test: update
2024-03-06 15:37:41 +01:00

20 lines
551 B
TypeScript

import { mountSuspended } from '@nuxt/test-utils/runtime'
import path from 'path'
export default async function (nameOrHtml: string, options: any, component: any) {
let html: string
const name = path.parse(component.__file).name
if (options === undefined) {
const app = {
template: nameOrHtml,
components: { [`U${name}`]: component }
}
const result = await mountSuspended(app)
html = result.html()
} else {
const cResult = await mountSuspended(component, options)
html = cResult.html()
}
return html
}