Move globalThis.crypto polyfill to fx.ts so it runs for all specs

This commit is contained in:
Asier Isayas
2026-08-13 15:18:34 -04:00
parent b98905f8be
commit bae4249590
2 changed files with 8 additions and 8 deletions
+8 -1
View File
@@ -1,8 +1,15 @@
import { DefaultAzureCredential } from "@azure/identity";
import { Frame, Locator, Page, expect } from "@playwright/test";
import crypto from "crypto";
import crypto, { webcrypto } from "crypto";
import { TestContainerContext } from "./testData";
// The @azure/cosmos client signs requests with globalThis.crypto (Web Crypto API).
// In Node.js >= 19 it's already available; only assign the polyfill for older versions.
// This lives in fx.ts (imported by every spec) so the polyfill always runs.
if (!globalThis.crypto) {
Object.defineProperty(globalThis, "crypto", { value: webcrypto, writable: true, configurable: true });
}
const RETRY_COUNT = 3;
export interface TestNameOptions {