From d9314a869a40f382f06ee2e767fe6c6501a055c4 Mon Sep 17 00:00:00 2001 From: Yokozuna59 Date: Mon, 17 Jul 2023 15:58:58 +0300 Subject: [PATCH] change deprecated `btoa` into `Buffer.from` --- cypress/helpers/util.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cypress/helpers/util.ts b/cypress/helpers/util.ts index 2e9254e6a..b042c3ed4 100644 --- a/cypress/helpers/util.ts +++ b/cypress/helpers/util.ts @@ -1,3 +1,5 @@ +/* eslint-disable @typescript-eslint/no-explicit-any */ +import { Buffer } from 'buffer'; import type { MermaidConfig } from '../../packages/mermaid/src/config.type.js'; type CypressConfig = { @@ -13,7 +15,7 @@ interface CodeObject { } const utf8ToB64 = (str: string): string => { - return window.btoa(decodeURIComponent(encodeURIComponent(str))); + return Buffer.from(decodeURIComponent(encodeURIComponent(str))).toString('base64'); }; const batchId: string = 'mermaid-batch-' + Cypress.env('CYPRESS_COMMIT') || Date.now().toString();