mirror of
https://github.com/getpaseo/paseo.git
synced 2026-07-29 12:01:31 +00:00
app: fix Playwright e2e helpers using import.meta.url in CJS context
Revert dynamic import path resolution from `new URL(..., import.meta.url)` to `path.resolve(__dirname, ...)` + `pathToFileURL(...)` in three e2e helpers. Playwright's TS loader emits CommonJS, where import.meta.url is undefined, causing "exports is not defined in ES module scope" and blocking all e2e test discovery. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
import { expect, type Page } from "@playwright/test";
|
||||
import path from "node:path";
|
||||
import { pathToFileURL } from "node:url";
|
||||
import { randomUUID } from "node:crypto";
|
||||
import { buildHostWorkspaceRoute } from "../../src/utils/host-routes";
|
||||
|
||||
@@ -88,7 +90,10 @@ async function loadDaemonClientConstructor(): Promise<
|
||||
clientType: "cli";
|
||||
}) => DaemonClientInstance
|
||||
> {
|
||||
const moduleUrl = new URL("../../../server/dist/server/server/exports.js", import.meta.url).href;
|
||||
const repoRoot = path.resolve(__dirname, "../../../../");
|
||||
const moduleUrl = pathToFileURL(
|
||||
path.join(repoRoot, "packages/server/dist/server/server/exports.js"),
|
||||
).href;
|
||||
const mod = (await import(moduleUrl)) as {
|
||||
DaemonClient: new (config: {
|
||||
url: string;
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
import { randomUUID } from "node:crypto";
|
||||
import path from "node:path";
|
||||
import { pathToFileURL } from "node:url";
|
||||
import { expect, type Page } from "@playwright/test";
|
||||
import { buildCreateAgentPreferences, buildSeededHost } from "./daemon-registry";
|
||||
import { waitForWorkspaceTabsVisible } from "./workspace-tabs";
|
||||
@@ -72,7 +74,10 @@ async function loadDaemonClientConstructor(): Promise<
|
||||
clientType: "cli";
|
||||
}) => ArchiveTabDaemonClient
|
||||
> {
|
||||
const moduleUrl = new URL("../../../server/dist/server/server/exports.js", import.meta.url).href;
|
||||
const repoRoot = path.resolve(__dirname, "../../../../");
|
||||
const moduleUrl = pathToFileURL(
|
||||
path.join(repoRoot, "packages/server/dist/server/server/exports.js"),
|
||||
).href;
|
||||
const mod = (await import(moduleUrl)) as {
|
||||
DaemonClient: new (config: {
|
||||
url: string;
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
import type { Page } from "@playwright/test";
|
||||
import path from "node:path";
|
||||
import { pathToFileURL } from "node:url";
|
||||
import { randomUUID } from "node:crypto";
|
||||
import { buildHostWorkspaceRoute } from "../../src/utils/host-routes";
|
||||
|
||||
@@ -48,7 +50,10 @@ async function loadDaemonClientConstructor(): Promise<
|
||||
clientType: "cli";
|
||||
}) => TerminalPerfDaemonClient
|
||||
> {
|
||||
const moduleUrl = new URL("../../../server/dist/server/server/exports.js", import.meta.url).href;
|
||||
const repoRoot = path.resolve(__dirname, "../../../../");
|
||||
const moduleUrl = pathToFileURL(
|
||||
path.join(repoRoot, "packages/server/dist/server/server/exports.js"),
|
||||
).href;
|
||||
const mod = (await import(moduleUrl)) as {
|
||||
DaemonClient: new (config: {
|
||||
url: string;
|
||||
|
||||
Reference in New Issue
Block a user