e2e: fix console-gate ESM __dirname (use import.meta.url)

This commit is contained in:
2026-04-25 02:27:11 +03:00
parent d458664b55
commit eda3352f90
+3 -1
View File
@@ -1,6 +1,7 @@
import { test as base, expect } from "@playwright/test";
import fs from "node:fs";
import path from "node:path";
import { fileURLToPath } from "node:url";
interface AllowlistEntry {
pattern: string;
@@ -11,7 +12,8 @@ interface Allowlist {
patterns: AllowlistEntry[];
}
const ALLOWLIST_PATH = path.join(__dirname, "console-allowlist.json");
const FIXTURE_DIR = path.dirname(fileURLToPath(import.meta.url));
const ALLOWLIST_PATH = path.join(FIXTURE_DIR, "console-allowlist.json");
function loadAllowlist(): RegExp[] {
const raw = fs.readFileSync(ALLOWLIST_PATH, "utf8");