From 0a301ee641a02167981abc6740fa5170db932b90 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=A5=E9=BA=92?= Date: Thu, 9 Jul 2026 19:51:15 +0800 Subject: [PATCH] test(e2e): run proxy probe with tsx --- packages/cli/tests/e2e/helpers.ts | 2 +- packages/cli/tests/e2e/proxy.e2e.test.ts | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/cli/tests/e2e/helpers.ts b/packages/cli/tests/e2e/helpers.ts index 1e44c16..8f28d83 100644 --- a/packages/cli/tests/e2e/helpers.ts +++ b/packages/cli/tests/e2e/helpers.ts @@ -28,7 +28,7 @@ export function monorepoRoot(): string { return join(cliPackageRoot, "..", ".."); } -function localBin(name: string): string { +export function localBin(name: string): string { return join( monorepoRoot(), "node_modules", diff --git a/packages/cli/tests/e2e/proxy.e2e.test.ts b/packages/cli/tests/e2e/proxy.e2e.test.ts index b92692c..b0258eb 100644 --- a/packages/cli/tests/e2e/proxy.e2e.test.ts +++ b/packages/cli/tests/e2e/proxy.e2e.test.ts @@ -6,7 +6,7 @@ import { tmpdir } from "os"; import { join } from "path"; import { promisify } from "util"; import { afterAll, beforeAll, describe, expect, test } from "vite-plus/test"; -import { cliPackageRoot } from "./helpers.ts"; +import { cliPackageRoot, localBin } from "./helpers.ts"; const execFileAsync = promisify(execFile); @@ -54,7 +54,7 @@ beforeAll(async () => { proxyUrl = `http://127.0.0.1:${(proxy.address() as AddressInfo).port}`; scriptDir = mkdtempSync(join(tmpdir(), "bl-proxy-e2e-")); - scriptPath = join(scriptDir, "probe.ts"); + scriptPath = join(scriptDir, "probe.mts"); writeFileSync(scriptPath, PROBE_SCRIPT); }); @@ -75,7 +75,7 @@ async function runProbe( envOverrides: NodeJS.ProcessEnv, ): Promise<{ exitCode: number; stderr: string }> { try { - await execFileAsync("node", [scriptPath], { + await execFileAsync(localBin("tsx"), [scriptPath], { cwd: cliPackageRoot, encoding: "utf8", env: { ...process.env, NODE_NO_WARNINGS: "1", ...PROXY_ENV_CLEARED, ...envOverrides },