From c3e9b14b5ff74e703a026630556a5d43e65993d1 Mon Sep 17 00:00:00 2001 From: Alexander Schranz Date: Mon, 5 Dec 2022 20:59:49 +0100 Subject: [PATCH] Use global not as variable name to fix problem with Jest --- packages/ckeditor5-utils/src/dom/global.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/ckeditor5-utils/src/dom/global.ts b/packages/ckeditor5-utils/src/dom/global.ts index 807a4d15d04..4951a4de835 100644 --- a/packages/ckeditor5-utils/src/dom/global.ts +++ b/packages/ckeditor5-utils/src/dom/global.ts @@ -34,11 +34,11 @@ export interface GlobalType { * console.log( global.window.innerWidth ); * ``` */ -let global: GlobalType; +let globalVar: GlobalType; // named globalVar instead of global: https://github.com/ckeditor/ckeditor5/issues/12971 // In some environments window and document API might not be available. try { - global = { window, document }; + globalVar = { window, document }; } catch ( e ) { // It's not possible to mock a window object to simulate lack of a window object without writing extremely convoluted code. /* istanbul ignore next */ @@ -47,7 +47,7 @@ try { // We only handle this so loading editor in environments without window and document doesn't fail. // For better DX we shouldn't introduce mixed types and require developers to check the type manually. // This module should not be used on purpose in any environment outside browser. - global = { window: {} as any, document: {} as any }; + globalVar = { window: {} as any, document: {} as any }; } -export default global; +export default globalVar;