From d1dda8e380ab416f795e540c0e9b5fa1ec6109c1 Mon Sep 17 00:00:00 2001 From: Hiroshi Ogawa Date: Mon, 11 Nov 2024 11:26:44 +0900 Subject: [PATCH] fix: fix type test collect --- packages/vitest/src/typecheck/collect.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/vitest/src/typecheck/collect.ts b/packages/vitest/src/typecheck/collect.ts index de4e39ab4782c..16a4609b5dcbe 100644 --- a/packages/vitest/src/typecheck/collect.ts +++ b/packages/vitest/src/typecheck/collect.ts @@ -47,10 +47,14 @@ export async function collectTests( ctx: WorkspaceProject, filepath: string, ): Promise { + // TODO: can we avoid ssr transform entirely? + // const request = await ctx.server.transformRequest(filepath) const request = await ctx.vitenode.transformRequest(filepath, filepath) if (!request) { return null } + // unwrap __vite_ssr_identity__ for now + request.code = request.code.replace(/__vite_ssr_identity__\((\w+\.\w+)\)/g, '$1') const ast = await parseAstAsync(request.code) const testFilepath = relative(ctx.config.root, filepath) const projectName = ctx.getName()