@itwin/unified-selection-react
Version:
React components for making use of `@itwin/unified-selection` package in React applications more straightforward
43 lines • 1.44 kB
JavaScript
/*---------------------------------------------------------------------------------------------
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
* See LICENSE.md in the project root for license terms and full copyright notice.
*--------------------------------------------------------------------------------------------*/
// WARNING: The order of imports in this file is important!
// get rid of various xhr errors in the console
import globalJsdom from "global-jsdom";
import * as jsdom from "jsdom";
globalJsdom(undefined, {
virtualConsole: new jsdom.VirtualConsole().sendTo(console, { omitJSDOMErrors: true }),
});
// supply mocha hooks
import v8 from "node:v8";
const { cleanup } = await import("@testing-library/react");
export const mochaHooks = {
beforeAll() {
getGlobalThis().IS_REACT_ACT_ENVIRONMENT = true;
},
beforeEach() { },
afterEach() {
cleanup();
},
afterAll() {
delete getGlobalThis().IS_REACT_ACT_ENVIRONMENT;
v8.takeCoverage();
},
};
function getGlobalThis() {
if (typeof globalThis !== "undefined") {
return globalThis;
}
if (typeof self !== "undefined") {
return self;
}
if (typeof window !== "undefined") {
return window;
}
if (typeof global !== "undefined") {
return global;
}
throw new Error("unable to locate global object");
}
//# sourceMappingURL=setup.js.map