(code: string, options?: CliOptions)
| 1652 | }) |
| 1653 | |
| 1654 | async function collectTestModule(code: string, options?: CliOptions) { |
| 1655 | const vitest = await createVitest( |
| 1656 | 'test', |
| 1657 | { |
| 1658 | config: false, |
| 1659 | includeTaskLocation: true, |
| 1660 | allowOnly: true, |
| 1661 | ...options, |
| 1662 | tags: [ |
| 1663 | { name: 'slow' }, |
| 1664 | { name: 'integration' }, |
| 1665 | { name: 'unit' }, |
| 1666 | ], |
| 1667 | }, |
| 1668 | { |
| 1669 | plugins: [ |
| 1670 | { |
| 1671 | name: 'ast-collect-test', |
| 1672 | load(id) { |
| 1673 | if (id === 'simple.test.ts') { |
| 1674 | return code |
| 1675 | } |
| 1676 | }, |
| 1677 | }, |
| 1678 | ], |
| 1679 | }, |
| 1680 | ) |
| 1681 | onTestFinished(() => vitest.close()) |
| 1682 | return vitest.experimental_parseSpecification( |
| 1683 | vitest.getRootProject().createSpecification('simple.test.ts'), |
| 1684 | ) |
| 1685 | } |
| 1686 | |
| 1687 | async function collectTests(code: string, options?: CliOptions & { fnFn?: boolean }) { |
| 1688 | return testTree(await collectTestModule(code, options), {}, options?.fnFn) |
no test coverage detected