e2e: fix console-gate ESM __dirname (use import.meta.url)
This commit is contained in:
@@ -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");
|
||||
|
||||
Reference in New Issue
Block a user