nx/packages/react/src/utils/get-in-source-vitest-tests-template.ts

18 lines
454 B
TypeScript

export function getInSourceVitestTestsTemplate(testContent: string) {
return `
if (import.meta.vitest) {
// add tests related to your file here
// For more information please visit the Vitest docs site here: https://vitest.dev/guide/in-source.html
const { it, expect, beforeEach } = import.meta.vitest;
let render: any;
beforeEach(async () => {
render = (await import('@testing-library/react')).render;
});
${testContent}
}
`;
}