Skip to content

Commit d1dda8e

Browse files
committed
fix: fix type test collect
1 parent 147165a commit d1dda8e

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

packages/vitest/src/typecheck/collect.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,14 @@ export async function collectTests(
4747
ctx: WorkspaceProject,
4848
filepath: string,
4949
): Promise<null | FileInformation> {
50+
// TODO: can we avoid ssr transform entirely?
51+
// const request = await ctx.server.transformRequest(filepath)
5052
const request = await ctx.vitenode.transformRequest(filepath, filepath)
5153
if (!request) {
5254
return null
5355
}
56+
// unwrap __vite_ssr_identity__ for now
57+
request.code = request.code.replace(/__vite_ssr_identity__\((\w+\.\w+)\)/g, '$1')
5458
const ast = await parseAstAsync(request.code)
5559
const testFilepath = relative(ctx.config.root, filepath)
5660
const projectName = ctx.getName()

0 commit comments

Comments
 (0)