From 88c2e34f089621e3f708db4235236e3b4236051a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9e=20Kooi?= Date: Thu, 26 Dec 2024 19:47:48 +0100 Subject: [PATCH] bump min-react-env --- package.json | 2 +- test/util/render.jsx | 10 ++++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index a548157..025828f 100644 --- a/package.json +++ b/package.json @@ -27,7 +27,7 @@ "eslint-plugin-react": "^7.20.3", "eslint-plugin-react-hooks": "^4.0.5", "md-insert": "^1.0.1", - "min-react-env": "^1.0.1", + "min-react-env": "^2.0.0", "prop-types-table": "^1.0.0", "react": "^18.0.0", "react-dom": "^18.0.0", diff --git a/test/util/render.jsx b/test/util/render.jsx index c56bf06..9a86f0a 100644 --- a/test/util/render.jsx +++ b/test/util/render.jsx @@ -3,13 +3,15 @@ * https://github.com/troybetz/react-youtube */ +/* global document */ + import React from 'react'; import ReactDOM from 'react-dom'; import { act } from 'react-dom/test-utils'; -import env from 'min-react-env'; +import 'min-react-env/install'; import createYouTube from './createYouTube'; -Object.assign(global, env); +const reactMajor = parseInt((ReactDOM.version || '16').split('.')[0], 10); async function render(initialProps) { const { YouTube, sdkMock, playerMock } = createYouTube(); @@ -44,9 +46,9 @@ async function render(initialProps) { } } - const div = env.document.createElement('div'); + const div = document.createElement('div'); let root; - if (ReactDOM.version.startsWith('18') || ReactDOM.version.startsWith('19')) { + if (reactMajor >= 18) { const { createRoot } = await import('react-dom/client'); root = createRoot(div); } else {