Files
ui/test/components/component-render.ts
Daniel Roe 1a1c640220 chore: migrate to @nuxt/test-utils alpha (#1133)
* test: update snapshots to remove quotes

* chore: add alpha versions of test-utils

* chore: migrate to new test format

* test: slightly improve typing in suite

* test: improve safety of basic test
2023-12-19 11:37:57 +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
}