From 52ec8d658fc3eef2e68a06bdd0f8541060986f12 Mon Sep 17 00:00:00 2001 From: CI Bot Date: Mon, 20 Jul 2026 17:49:04 +0800 Subject: [PATCH] =?UTF-8?q?fix(e2e):=20=E4=BF=AE=E5=A4=8DESM=E6=A8=A1?= =?UTF-8?q?=E5=BC=8F=E4=B8=8B=5F=5Fdirname=E6=9C=AA=E5=AE=9A=E4=B9=89?= =?UTF-8?q?=E5=AF=BC=E8=87=B4Staging=20E2E=E5=A4=B1=E8=B4=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 根因:Playwright在ESM模式下运行,CommonJS的__dirname全局变量不存在。 修复:使用fileURLToPath(import.meta.url) + path.dirname 实现ESM兼容的__dirname。 影响用例: - core-generation.spec.ts: walks through 5-step wizard and starts generation - core-upload.spec.ts: uploads a video asset and shows it in the asset library --- apps/web/e2e/core-generation.spec.ts | 2 ++ apps/web/e2e/core-upload.spec.ts | 2 ++ 2 files changed, 4 insertions(+) diff --git a/apps/web/e2e/core-generation.spec.ts b/apps/web/e2e/core-generation.spec.ts index 06427acf1..ef3df6773 100755 --- a/apps/web/e2e/core-generation.spec.ts +++ b/apps/web/e2e/core-generation.spec.ts @@ -1,7 +1,9 @@ import { expect, test, type APIRequestContext } from "@playwright/test" import * as fs from "node:fs" import * as path from "node:path" +import { fileURLToPath } from "node:url" +const __dirname = path.dirname(fileURLToPath(import.meta.url)) const PASSWORD = "SmokePass123!" const apiBase = process.env.E2E_API_BASE || "/api/v1" const apiOrigin = apiBase.endsWith("/api/v1") ? apiBase.slice(0, -"/api/v1".length) : "" diff --git a/apps/web/e2e/core-upload.spec.ts b/apps/web/e2e/core-upload.spec.ts index e3ba3af49..9c036632d 100755 --- a/apps/web/e2e/core-upload.spec.ts +++ b/apps/web/e2e/core-upload.spec.ts @@ -1,7 +1,9 @@ import { expect, test, type APIRequestContext } from "@playwright/test" import * as fs from "node:fs" import * as path from "node:path" +import { fileURLToPath } from "node:url" +const __dirname = path.dirname(fileURLToPath(import.meta.url)) const PASSWORD = "SmokePass123!" const apiBase = process.env.E2E_API_BASE || "/api/v1" const apiOrigin = apiBase.endsWith("/api/v1") ? apiBase.slice(0, -"/api/v1".length) : "" -- 2.54.0