New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@testing-library/react

Package Overview
Dependencies
Maintainers
16
Versions
119
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@testing-library/react - npm Package Compare versions

Comparing version 16.1.0 to 16.2.0

20

dist/@testing-library/react.cjs.js

@@ -269,2 +269,4 @@ 'use strict';

hydrate,
onCaughtError,
onRecoverableError,
ui,

@@ -276,6 +278,12 @@ wrapper: WrapperComponent

act(() => {
root = ReactDOMClient__namespace.hydrateRoot(container, strictModeIfNeeded(wrapUiIfNeeded(ui, WrapperComponent)));
root = ReactDOMClient__namespace.hydrateRoot(container, strictModeIfNeeded(wrapUiIfNeeded(ui, WrapperComponent)), {
onCaughtError,
onRecoverableError
});
});
} else {
root = ReactDOMClient__namespace.createRoot(container);
root = ReactDOMClient__namespace.createRoot(container, {
onCaughtError,
onRecoverableError
});
}

@@ -373,2 +381,5 @@ return {

legacyRoot = false,
onCaughtError,
onUncaughtError,
onRecoverableError,
queries,

@@ -378,2 +389,5 @@ hydrate = false,

} = _temp === void 0 ? {} : _temp;
if (onUncaughtError !== undefined) {
throw new Error('onUncaughtError is not supported. The `render` call will already throw on uncaught errors.');
}
if (legacyRoot && typeof ReactDOM__default["default"].render !== 'function') {

@@ -398,2 +412,4 @@ const error = new Error('`legacyRoot: true` is not supported in this version of React. ' + 'If your app runs React 19 or later, you should remove this flag. ' + 'If your app runs React 18 or earlier, visit https://react.dev/blog/2022/03/08/react-18-upgrade-guide for upgrade instructions.');

hydrate,
onCaughtError,
onRecoverableError,
ui,

@@ -400,0 +416,0 @@ wrapper

@@ -241,2 +241,4 @@ import * as React from 'react';

hydrate,
onCaughtError,
onRecoverableError,
ui,

@@ -248,6 +250,12 @@ wrapper: WrapperComponent

act(() => {
root = ReactDOMClient.hydrateRoot(container, strictModeIfNeeded(wrapUiIfNeeded(ui, WrapperComponent)));
root = ReactDOMClient.hydrateRoot(container, strictModeIfNeeded(wrapUiIfNeeded(ui, WrapperComponent)), {
onCaughtError,
onRecoverableError
});
});
} else {
root = ReactDOMClient.createRoot(container);
root = ReactDOMClient.createRoot(container, {
onCaughtError,
onRecoverableError
});
}

@@ -345,2 +353,5 @@ return {

legacyRoot = false,
onCaughtError,
onUncaughtError,
onRecoverableError,
queries,

@@ -350,2 +361,5 @@ hydrate = false,

} = _temp === void 0 ? {} : _temp;
if (onUncaughtError !== undefined) {
throw new Error('onUncaughtError is not supported. The `render` call will already throw on uncaught errors.');
}
if (legacyRoot && typeof ReactDOM.render !== 'function') {

@@ -370,2 +384,4 @@ const error = new Error('`legacyRoot: true` is not supported in this version of React. ' + 'If your app runs React 19 or later, you should remove this flag. ' + 'If your app runs React 18 or earlier, visit https://react.dev/blog/2022/03/08/react-18-upgrade-guide for upgrade instructions.');

hydrate,
onCaughtError,
onRecoverableError,
ui,

@@ -372,0 +388,0 @@ wrapper

@@ -269,2 +269,4 @@ 'use strict';

hydrate,
onCaughtError,
onRecoverableError,
ui,

@@ -276,6 +278,12 @@ wrapper: WrapperComponent

act(() => {
root = ReactDOMClient__namespace.hydrateRoot(container, strictModeIfNeeded(wrapUiIfNeeded(ui, WrapperComponent)));
root = ReactDOMClient__namespace.hydrateRoot(container, strictModeIfNeeded(wrapUiIfNeeded(ui, WrapperComponent)), {
onCaughtError,
onRecoverableError
});
});
} else {
root = ReactDOMClient__namespace.createRoot(container);
root = ReactDOMClient__namespace.createRoot(container, {
onCaughtError,
onRecoverableError
});
}

@@ -373,2 +381,5 @@ return {

legacyRoot = false,
onCaughtError,
onUncaughtError,
onRecoverableError,
queries,

@@ -378,2 +389,5 @@ hydrate = false,

} = _temp === void 0 ? {} : _temp;
if (onUncaughtError !== undefined) {
throw new Error('onUncaughtError is not supported. The `render` call will already throw on uncaught errors.');
}
if (legacyRoot && typeof ReactDOM__default["default"].render !== 'function') {

@@ -398,2 +412,4 @@ const error = new Error('`legacyRoot: true` is not supported in this version of React. ' + 'If your app runs React 19 or later, you should remove this flag. ' + 'If your app runs React 18 or earlier, visit https://react.dev/blog/2022/03/08/react-18-upgrade-guide for upgrade instructions.');

hydrate,
onCaughtError,
onRecoverableError,
ui,

@@ -400,0 +416,0 @@ wrapper

@@ -241,2 +241,4 @@ import * as React from 'react';

hydrate,
onCaughtError,
onRecoverableError,
ui,

@@ -248,6 +250,12 @@ wrapper: WrapperComponent

act(() => {
root = ReactDOMClient.hydrateRoot(container, strictModeIfNeeded(wrapUiIfNeeded(ui, WrapperComponent)));
root = ReactDOMClient.hydrateRoot(container, strictModeIfNeeded(wrapUiIfNeeded(ui, WrapperComponent)), {
onCaughtError,
onRecoverableError
});
});
} else {
root = ReactDOMClient.createRoot(container);
root = ReactDOMClient.createRoot(container, {
onCaughtError,
onRecoverableError
});
}

@@ -345,2 +353,5 @@ return {

legacyRoot = false,
onCaughtError,
onUncaughtError,
onRecoverableError,
queries,

@@ -350,2 +361,5 @@ hydrate = false,

} = _temp === void 0 ? {} : _temp;
if (onUncaughtError !== undefined) {
throw new Error('onUncaughtError is not supported. The `render` call will already throw on uncaught errors.');
}
if (legacyRoot && typeof ReactDOM.render !== 'function') {

@@ -370,2 +384,4 @@ const error = new Error('`legacyRoot: true` is not supported in this version of React. ' + 'If your app runs React 19 or later, you should remove this flag. ' + 'If your app runs React 18 or earlier, visit https://react.dev/blog/2022/03/08/react-18-upgrade-guide for upgrade instructions.');

hydrate,
onCaughtError,
onRecoverableError,
ui,

@@ -372,0 +388,0 @@ wrapper

@@ -265,2 +265,4 @@ (function (global, factory) {

hydrate,
onCaughtError,
onRecoverableError,
ui,

@@ -272,6 +274,12 @@ wrapper: WrapperComponent

act(() => {
root = ReactDOMClient__namespace.hydrateRoot(container, strictModeIfNeeded(wrapUiIfNeeded(ui, WrapperComponent)));
root = ReactDOMClient__namespace.hydrateRoot(container, strictModeIfNeeded(wrapUiIfNeeded(ui, WrapperComponent)), {
onCaughtError,
onRecoverableError
});
});
} else {
root = ReactDOMClient__namespace.createRoot(container);
root = ReactDOMClient__namespace.createRoot(container, {
onCaughtError,
onRecoverableError
});
}

@@ -369,2 +377,5 @@ return {

legacyRoot = false,
onCaughtError,
onUncaughtError,
onRecoverableError,
queries,

@@ -374,2 +385,5 @@ hydrate = false,

} = _temp === void 0 ? {} : _temp;
if (onUncaughtError !== undefined) {
throw new Error('onUncaughtError is not supported. The `render` call will already throw on uncaught errors.');
}
if (legacyRoot && typeof ReactDOM__default["default"].render !== 'function') {

@@ -394,2 +408,4 @@ const error = new Error('`legacyRoot: true` is not supported in this version of React. ' + 'If your app runs React 19 or later, you should remove this flag. ' + 'If your app runs React 18 or earlier, visit https://react.dev/blog/2022/03/08/react-18-upgrade-guide for upgrade instructions.');

hydrate,
onCaughtError,
onRecoverableError,
ui,

@@ -396,0 +412,0 @@ wrapper

2

dist/@testing-library/react.pure.umd.min.js

@@ -1,2 +0,2 @@

!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react"),require("react-dom"),require("react-dom/client"),require("@testing-library/dom"),require("react-dom/test-utils")):"function"==typeof define&&define.amd?define(["exports","react","react-dom","react-dom/client","@testing-library/dom","react-dom/test-utils"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).TestingLibraryReact={},e.React,e.ReactDOM,e.ReactDOMClient,e.dom,e.ReactTestUtils)}(this,(function(e,t,r,n,o,u){"use strict";function c(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}function a(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(r){if("default"!==r){var n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:function(){return e[r]}})}})),t.default=e,Object.freeze(t)}var i=a(t),f=c(r),s=a(n),l=a(u);const d="function"==typeof i.act?i.act:l.act;function p(){if("undefined"!=typeof globalThis)return globalThis;if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;if("undefined"!=typeof global)return global;throw new Error("unable to locate global object")}function y(e){p().IS_REACT_ACT_ENVIRONMENT=e}function m(){return p().IS_REACT_ACT_ENVIRONMENT}const h=(b=d,e=>{const t=m();y(!0);try{let r=!1;const n=b((()=>{const t=e();return null!==t&&"object"==typeof t&&"function"==typeof t.then&&(r=!0),t}));return r?{then:(e,r)=>{n.then((r=>{y(t),e(r)}),(e=>{y(t),r(e)}))}}:(y(t),n)}catch(e){throw y(t),e}});var b;const g=function(){return o.fireEvent(...arguments)};Object.keys(o.fireEvent).forEach((e=>{g[e]=function(){return o.fireEvent[e](...arguments)}}));const E=g.mouseEnter,v=g.mouseLeave;g.mouseEnter=function(){return E(...arguments),g.mouseOver(...arguments)},g.mouseLeave=function(){return v(...arguments),g.mouseOut(...arguments)};const w=g.pointerEnter,O=g.pointerLeave;g.pointerEnter=function(){return w(...arguments),g.pointerOver(...arguments)},g.pointerLeave=function(){return O(...arguments),g.pointerOut(...arguments)};const R=g.select;g.select=(e,t)=>{R(e,t),e.focus(),g.keyUp(e,t)};const T=g.blur,j=g.focus;g.blur=function(){return g.focusOut(...arguments),T(...arguments)},g.focus=function(){return g.focusIn(...arguments),j(...arguments)};let M={reactStrictMode:!1};function C(){return{...o.getConfig(),...M}}o.configure({unstable_advanceTimersWrapper:e=>h(e),asyncWrapper:async e=>{const t=m();y(!1);try{const t=await e();return await new Promise((e=>{setTimeout((()=>{e()}),0),"undefined"==typeof jest||null===jest||!0!==setTimeout._isMockFunction&&!Object.prototype.hasOwnProperty.call(setTimeout,"clock")||jest.advanceTimersByTime(0)})),t}finally{y(t)}},eventWrapper:e=>{let t;return h((()=>{t=e()})),t}});const k=new Set,_=[];function P(e){return C().reactStrictMode?i.createElement(i.StrictMode,null,e):e}function S(e,t){return t?i.createElement(t,null,e):e}function I(e,t){let r,{hydrate:n,ui:o,wrapper:u}=t;return n?h((()=>{r=s.hydrateRoot(e,P(S(o,u)))})):r=s.createRoot(e),{hydrate(){if(!n)throw new Error("Attempted to hydrate a non-hydrateable root. This is a bug in `@testing-library/react`.")},render(e){r.render(e)},unmount(){r.unmount()}}}function q(e){return{hydrate(t){f.default.hydrate(t,e)},render(t){f.default.render(t,e)},unmount(){f.default.unmountComponentAtNode(e)}}}function A(e,t){let{baseElement:r,container:n,hydrate:u,queries:c,root:a,wrapper:i}=t;return h((()=>{u?a.hydrate(P(S(e,i)),n):a.render(P(S(e,i)),n)})),{container:n,baseElement:r,debug:function(e,t,n){return void 0===e&&(e=r),Array.isArray(e)?e.forEach((e=>console.log(o.prettyDOM(e,t,n)))):console.log(o.prettyDOM(e,t,n))},unmount:()=>{h((()=>{a.unmount()}))},rerender:e=>{A(e,{container:n,baseElement:r,root:a,wrapper:i})},asFragment:()=>{if("function"==typeof document.createRange)return document.createRange().createContextualFragment(n.innerHTML);{const e=document.createElement("template");return e.innerHTML=n.innerHTML,e.content}},...o.getQueriesForElement(r,c)}}function L(e,t){let r,{container:n,baseElement:o=n,legacyRoot:u=!1,queries:c,hydrate:a=!1,wrapper:i}=void 0===t?{}:t;if(u&&"function"!=typeof f.default.render){const e=new Error("`legacyRoot: true` is not supported in this version of React. If your app runs React 19 or later, you should remove this flag. If your app runs React 18 or earlier, visit https://react.dev/blog/2022/03/08/react-18-upgrade-guide for upgrade instructions.");throw Error.captureStackTrace(e,L),e}if(o||(o=document.body),n||(n=o.appendChild(document.createElement("div"))),k.has(n))_.forEach((e=>{e.container===n&&(r=e.root)}));else{r=(u?q:I)(n,{hydrate:a,ui:e,wrapper:i}),_.push({container:n,root:r}),k.add(n)}return A(e,{container:n,baseElement:o,queries:c,hydrate:a,wrapper:i,root:r})}e.act=h,e.cleanup=function(){_.forEach((e=>{let{root:t,container:r}=e;h((()=>{t.unmount()})),r.parentNode===document.body&&document.body.removeChild(r)})),_.length=0,k.clear()},e.configure=function(e){"function"==typeof e&&(e=e(C()));const{reactStrictMode:t,...r}=e;o.configure(r),M={...M,reactStrictMode:t}},e.fireEvent=g,e.getConfig=C,e.render=L,e.renderHook=function e(t,r){void 0===r&&(r={});const{initialProps:n,...o}=r;if(o.legacyRoot&&"function"!=typeof f.default.render){const t=new Error("`legacyRoot: true` is not supported in this version of React. If your app runs React 19 or later, you should remove this flag. If your app runs React 18 or earlier, visit https://react.dev/blog/2022/03/08/react-18-upgrade-guide for upgrade instructions.");throw Error.captureStackTrace(t,e),t}const u=i.createRef();function c(e){let{renderCallbackProps:r}=e;const n=t(r);return i.useEffect((()=>{u.current=n})),null}const{rerender:a,unmount:s}=L(i.createElement(c,{renderCallbackProps:n}),o);return{result:u,rerender:function(e){return a(i.createElement(c,{renderCallbackProps:e}))},unmount:s}},Object.keys(o).forEach((function(t){"default"===t||e.hasOwnProperty(t)||Object.defineProperty(e,t,{enumerable:!0,get:function(){return o[t]}})})),Object.defineProperty(e,"__esModule",{value:!0})}));
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react"),require("react-dom"),require("react-dom/client"),require("@testing-library/dom"),require("react-dom/test-utils")):"function"==typeof define&&define.amd?define(["exports","react","react-dom","react-dom/client","@testing-library/dom","react-dom/test-utils"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).TestingLibraryReact={},e.React,e.ReactDOM,e.ReactDOMClient,e.dom,e.ReactTestUtils)}(this,(function(e,t,r,n,o,u){"use strict";function c(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}function a(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(r){if("default"!==r){var n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:function(){return e[r]}})}})),t.default=e,Object.freeze(t)}var i=a(t),l=c(r),f=a(n),s=a(u);const d="function"==typeof i.act?i.act:s.act;function p(){if("undefined"!=typeof globalThis)return globalThis;if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;if("undefined"!=typeof global)return global;throw new Error("unable to locate global object")}function y(e){p().IS_REACT_ACT_ENVIRONMENT=e}function m(){return p().IS_REACT_ACT_ENVIRONMENT}const h=(g=d,e=>{const t=m();y(!0);try{let r=!1;const n=g((()=>{const t=e();return null!==t&&"object"==typeof t&&"function"==typeof t.then&&(r=!0),t}));return r?{then:(e,r)=>{n.then((r=>{y(t),e(r)}),(e=>{y(t),r(e)}))}}:(y(t),n)}catch(e){throw y(t),e}});var g;const b=function(){return o.fireEvent(...arguments)};Object.keys(o.fireEvent).forEach((e=>{b[e]=function(){return o.fireEvent[e](...arguments)}}));const E=b.mouseEnter,v=b.mouseLeave;b.mouseEnter=function(){return E(...arguments),b.mouseOver(...arguments)},b.mouseLeave=function(){return v(...arguments),b.mouseOut(...arguments)};const w=b.pointerEnter,R=b.pointerLeave;b.pointerEnter=function(){return w(...arguments),b.pointerOver(...arguments)},b.pointerLeave=function(){return R(...arguments),b.pointerOut(...arguments)};const T=b.select;b.select=(e,t)=>{T(e,t),e.focus(),b.keyUp(e,t)};const O=b.blur,C=b.focus;b.blur=function(){return b.focusOut(...arguments),O(...arguments)},b.focus=function(){return b.focusIn(...arguments),C(...arguments)};let j={reactStrictMode:!1};function M(){return{...o.getConfig(),...j}}o.configure({unstable_advanceTimersWrapper:e=>h(e),asyncWrapper:async e=>{const t=m();y(!1);try{const t=await e();return await new Promise((e=>{setTimeout((()=>{e()}),0),"undefined"==typeof jest||null===jest||!0!==setTimeout._isMockFunction&&!Object.prototype.hasOwnProperty.call(setTimeout,"clock")||jest.advanceTimersByTime(0)})),t}finally{y(t)}},eventWrapper:e=>{let t;return h((()=>{t=e()})),t}});const k=new Set,_=[];function P(e){return M().reactStrictMode?i.createElement(i.StrictMode,null,e):e}function S(e,t){return t?i.createElement(t,null,e):e}function I(e,t){let r,{hydrate:n,onCaughtError:o,onRecoverableError:u,ui:c,wrapper:a}=t;return n?h((()=>{r=f.hydrateRoot(e,P(S(c,a)),{onCaughtError:o,onRecoverableError:u})})):r=f.createRoot(e,{onCaughtError:o,onRecoverableError:u}),{hydrate(){if(!n)throw new Error("Attempted to hydrate a non-hydrateable root. This is a bug in `@testing-library/react`.")},render(e){r.render(e)},unmount(){r.unmount()}}}function q(e){return{hydrate(t){l.default.hydrate(t,e)},render(t){l.default.render(t,e)},unmount(){l.default.unmountComponentAtNode(e)}}}function A(e,t){let{baseElement:r,container:n,hydrate:u,queries:c,root:a,wrapper:i}=t;return h((()=>{u?a.hydrate(P(S(e,i)),n):a.render(P(S(e,i)),n)})),{container:n,baseElement:r,debug:function(e,t,n){return void 0===e&&(e=r),Array.isArray(e)?e.forEach((e=>console.log(o.prettyDOM(e,t,n)))):console.log(o.prettyDOM(e,t,n))},unmount:()=>{h((()=>{a.unmount()}))},rerender:e=>{A(e,{container:n,baseElement:r,root:a,wrapper:i})},asFragment:()=>{if("function"==typeof document.createRange)return document.createRange().createContextualFragment(n.innerHTML);{const e=document.createElement("template");return e.innerHTML=n.innerHTML,e.content}},...o.getQueriesForElement(r,c)}}function L(e,t){let r,{container:n,baseElement:o=n,legacyRoot:u=!1,onCaughtError:c,onUncaughtError:a,onRecoverableError:i,queries:f,hydrate:s=!1,wrapper:d}=void 0===t?{}:t;if(void 0!==a)throw new Error("onUncaughtError is not supported. The `render` call will already throw on uncaught errors.");if(u&&"function"!=typeof l.default.render){const e=new Error("`legacyRoot: true` is not supported in this version of React. If your app runs React 19 or later, you should remove this flag. If your app runs React 18 or earlier, visit https://react.dev/blog/2022/03/08/react-18-upgrade-guide for upgrade instructions.");throw Error.captureStackTrace(e,L),e}if(o||(o=document.body),n||(n=o.appendChild(document.createElement("div"))),k.has(n))_.forEach((e=>{e.container===n&&(r=e.root)}));else{r=(u?q:I)(n,{hydrate:s,onCaughtError:c,onRecoverableError:i,ui:e,wrapper:d}),_.push({container:n,root:r}),k.add(n)}return A(e,{container:n,baseElement:o,queries:f,hydrate:s,wrapper:d,root:r})}e.act=h,e.cleanup=function(){_.forEach((e=>{let{root:t,container:r}=e;h((()=>{t.unmount()})),r.parentNode===document.body&&document.body.removeChild(r)})),_.length=0,k.clear()},e.configure=function(e){"function"==typeof e&&(e=e(M()));const{reactStrictMode:t,...r}=e;o.configure(r),j={...j,reactStrictMode:t}},e.fireEvent=b,e.getConfig=M,e.render=L,e.renderHook=function e(t,r){void 0===r&&(r={});const{initialProps:n,...o}=r;if(o.legacyRoot&&"function"!=typeof l.default.render){const t=new Error("`legacyRoot: true` is not supported in this version of React. If your app runs React 19 or later, you should remove this flag. If your app runs React 18 or earlier, visit https://react.dev/blog/2022/03/08/react-18-upgrade-guide for upgrade instructions.");throw Error.captureStackTrace(t,e),t}const u=i.createRef();function c(e){let{renderCallbackProps:r}=e;const n=t(r);return i.useEffect((()=>{u.current=n})),null}const{rerender:a,unmount:f}=L(i.createElement(c,{renderCallbackProps:n}),o);return{result:u,rerender:function(e){return a(i.createElement(c,{renderCallbackProps:e}))},unmount:f}},Object.keys(o).forEach((function(t){"default"===t||e.hasOwnProperty(t)||Object.defineProperty(e,t,{enumerable:!0,get:function(){return o[t]}})})),Object.defineProperty(e,"__esModule",{value:!0})}));
//# sourceMappingURL=react.pure.umd.min.js.map

@@ -265,2 +265,4 @@ (function (global, factory) {

hydrate,
onCaughtError,
onRecoverableError,
ui,

@@ -272,6 +274,12 @@ wrapper: WrapperComponent

act(() => {
root = ReactDOMClient__namespace.hydrateRoot(container, strictModeIfNeeded(wrapUiIfNeeded(ui, WrapperComponent)));
root = ReactDOMClient__namespace.hydrateRoot(container, strictModeIfNeeded(wrapUiIfNeeded(ui, WrapperComponent)), {
onCaughtError,
onRecoverableError
});
});
} else {
root = ReactDOMClient__namespace.createRoot(container);
root = ReactDOMClient__namespace.createRoot(container, {
onCaughtError,
onRecoverableError
});
}

@@ -369,2 +377,5 @@ return {

legacyRoot = false,
onCaughtError,
onUncaughtError,
onRecoverableError,
queries,

@@ -374,2 +385,5 @@ hydrate = false,

} = _temp === void 0 ? {} : _temp;
if (onUncaughtError !== undefined) {
throw new Error('onUncaughtError is not supported. The `render` call will already throw on uncaught errors.');
}
if (legacyRoot && typeof ReactDOM__default["default"].render !== 'function') {

@@ -394,2 +408,4 @@ const error = new Error('`legacyRoot: true` is not supported in this version of React. ' + 'If your app runs React 19 or later, you should remove this flag. ' + 'If your app runs React 18 or earlier, visit https://react.dev/blog/2022/03/08/react-18-upgrade-guide for upgrade instructions.');

hydrate,
onCaughtError,
onRecoverableError,
ui,

@@ -396,0 +412,0 @@ wrapper

@@ -1,2 +0,2 @@

!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react"),require("react-dom/test-utils"),require("react-dom"),require("react-dom/client"),require("@testing-library/dom")):"function"==typeof define&&define.amd?define(["exports","react","react-dom/test-utils","react-dom","react-dom/client","@testing-library/dom"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).TestingLibraryReact={},e.React,e.ReactTestUtils,e.ReactDOM,e.ReactDOMClient,e.dom)}(this,(function(e,t,r,n,o,u){"use strict";function c(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}function a(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(r){if("default"!==r){var n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:function(){return e[r]}})}})),t.default=e,Object.freeze(t)}var i=a(t),f=a(r),l=c(n),s=a(o);const d="function"==typeof i.act?i.act:f.act;function p(){if("undefined"!=typeof globalThis)return globalThis;if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;if("undefined"!=typeof global)return global;throw new Error("unable to locate global object")}function y(e){p().IS_REACT_ACT_ENVIRONMENT=e}function m(){return p().IS_REACT_ACT_ENVIRONMENT}const h=(b=d,e=>{const t=m();y(!0);try{let r=!1;const n=b((()=>{const t=e();return null!==t&&"object"==typeof t&&"function"==typeof t.then&&(r=!0),t}));return r?{then:(e,r)=>{n.then((r=>{y(t),e(r)}),(e=>{y(t),r(e)}))}}:(y(t),n)}catch(e){throw y(t),e}});var b;const g=function(){return u.fireEvent(...arguments)};Object.keys(u.fireEvent).forEach((e=>{g[e]=function(){return u.fireEvent[e](...arguments)}}));const E=g.mouseEnter,v=g.mouseLeave;g.mouseEnter=function(){return E(...arguments),g.mouseOver(...arguments)},g.mouseLeave=function(){return v(...arguments),g.mouseOut(...arguments)};const w=g.pointerEnter,T=g.pointerLeave;g.pointerEnter=function(){return w(...arguments),g.pointerOver(...arguments)},g.pointerLeave=function(){return T(...arguments),g.pointerOut(...arguments)};const O=g.select;g.select=(e,t)=>{O(e,t),e.focus(),g.keyUp(e,t)};const R=g.blur,j=g.focus;g.blur=function(){return g.focusOut(...arguments),R(...arguments)},g.focus=function(){return g.focusIn(...arguments),j(...arguments)};let M={reactStrictMode:!1};function C(){return{...u.getConfig(),...M}}u.configure({unstable_advanceTimersWrapper:e=>h(e),asyncWrapper:async e=>{const t=m();y(!1);try{const t=await e();return await new Promise((e=>{setTimeout((()=>{e()}),0),"undefined"==typeof jest||null===jest||!0!==setTimeout._isMockFunction&&!Object.prototype.hasOwnProperty.call(setTimeout,"clock")||jest.advanceTimersByTime(0)})),t}finally{y(t)}},eventWrapper:e=>{let t;return h((()=>{t=e()})),t}});const _=new Set,A=[];function P(e){return C().reactStrictMode?i.createElement(i.StrictMode,null,e):e}function k(e,t){return t?i.createElement(t,null,e):e}function S(e,t){let r,{hydrate:n,ui:o,wrapper:u}=t;return n?h((()=>{r=s.hydrateRoot(e,P(k(o,u)))})):r=s.createRoot(e),{hydrate(){if(!n)throw new Error("Attempted to hydrate a non-hydrateable root. This is a bug in `@testing-library/react`.")},render(e){r.render(e)},unmount(){r.unmount()}}}function I(e){return{hydrate(t){l.default.hydrate(t,e)},render(t){l.default.render(t,e)},unmount(){l.default.unmountComponentAtNode(e)}}}function L(e,t){let{baseElement:r,container:n,hydrate:o,queries:c,root:a,wrapper:i}=t;return h((()=>{o?a.hydrate(P(k(e,i)),n):a.render(P(k(e,i)),n)})),{container:n,baseElement:r,debug:function(e,t,n){return void 0===e&&(e=r),Array.isArray(e)?e.forEach((e=>console.log(u.prettyDOM(e,t,n)))):console.log(u.prettyDOM(e,t,n))},unmount:()=>{h((()=>{a.unmount()}))},rerender:e=>{L(e,{container:n,baseElement:r,root:a,wrapper:i})},asFragment:()=>{if("function"==typeof document.createRange)return document.createRange().createContextualFragment(n.innerHTML);{const e=document.createElement("template");return e.innerHTML=n.innerHTML,e.content}},...u.getQueriesForElement(r,c)}}function N(e,t){let r,{container:n,baseElement:o=n,legacyRoot:u=!1,queries:c,hydrate:a=!1,wrapper:i}=void 0===t?{}:t;if(u&&"function"!=typeof l.default.render){const e=new Error("`legacyRoot: true` is not supported in this version of React. If your app runs React 19 or later, you should remove this flag. If your app runs React 18 or earlier, visit https://react.dev/blog/2022/03/08/react-18-upgrade-guide for upgrade instructions.");throw Error.captureStackTrace(e,N),e}if(o||(o=document.body),n||(n=o.appendChild(document.createElement("div"))),_.has(n))A.forEach((e=>{e.container===n&&(r=e.root)}));else{r=(u?I:S)(n,{hydrate:a,ui:e,wrapper:i}),A.push({container:n,root:r}),_.add(n)}return L(e,{container:n,baseElement:o,queries:c,hydrate:a,wrapper:i,root:r})}function q(){A.forEach((e=>{let{root:t,container:r}=e;h((()=>{t.unmount()})),r.parentNode===document.body&&document.body.removeChild(r)})),A.length=0,_.clear()}if(("undefined"==typeof process||!process.env?.RTL_SKIP_AUTO_CLEANUP)&&("function"==typeof afterEach?afterEach((()=>{q()})):"function"==typeof teardown&&teardown((()=>{q()})),"function"==typeof beforeAll&&"function"==typeof afterAll)){let e=m();beforeAll((()=>{e=m(),y(!0)})),afterAll((()=>{y(e)}))}e.act=h,e.cleanup=q,e.configure=function(e){"function"==typeof e&&(e=e(C()));const{reactStrictMode:t,...r}=e;u.configure(r),M={...M,reactStrictMode:t}},e.fireEvent=g,e.getConfig=C,e.render=N,e.renderHook=function e(t,r){void 0===r&&(r={});const{initialProps:n,...o}=r;if(o.legacyRoot&&"function"!=typeof l.default.render){const t=new Error("`legacyRoot: true` is not supported in this version of React. If your app runs React 19 or later, you should remove this flag. If your app runs React 18 or earlier, visit https://react.dev/blog/2022/03/08/react-18-upgrade-guide for upgrade instructions.");throw Error.captureStackTrace(t,e),t}const u=i.createRef();function c(e){let{renderCallbackProps:r}=e;const n=t(r);return i.useEffect((()=>{u.current=n})),null}const{rerender:a,unmount:f}=N(i.createElement(c,{renderCallbackProps:n}),o);return{result:u,rerender:function(e){return a(i.createElement(c,{renderCallbackProps:e}))},unmount:f}},Object.keys(u).forEach((function(t){"default"===t||e.hasOwnProperty(t)||Object.defineProperty(e,t,{enumerable:!0,get:function(){return u[t]}})})),Object.defineProperty(e,"__esModule",{value:!0})}));
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react"),require("react-dom/test-utils"),require("react-dom"),require("react-dom/client"),require("@testing-library/dom")):"function"==typeof define&&define.amd?define(["exports","react","react-dom/test-utils","react-dom","react-dom/client","@testing-library/dom"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).TestingLibraryReact={},e.React,e.ReactTestUtils,e.ReactDOM,e.ReactDOMClient,e.dom)}(this,(function(e,t,r,n,o,u){"use strict";function c(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}function a(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(r){if("default"!==r){var n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:function(){return e[r]}})}})),t.default=e,Object.freeze(t)}var i=a(t),f=a(r),l=c(n),s=a(o);const d="function"==typeof i.act?i.act:f.act;function p(){if("undefined"!=typeof globalThis)return globalThis;if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;if("undefined"!=typeof global)return global;throw new Error("unable to locate global object")}function y(e){p().IS_REACT_ACT_ENVIRONMENT=e}function m(){return p().IS_REACT_ACT_ENVIRONMENT}const h=(E=d,e=>{const t=m();y(!0);try{let r=!1;const n=E((()=>{const t=e();return null!==t&&"object"==typeof t&&"function"==typeof t.then&&(r=!0),t}));return r?{then:(e,r)=>{n.then((r=>{y(t),e(r)}),(e=>{y(t),r(e)}))}}:(y(t),n)}catch(e){throw y(t),e}});var E;const b=function(){return u.fireEvent(...arguments)};Object.keys(u.fireEvent).forEach((e=>{b[e]=function(){return u.fireEvent[e](...arguments)}}));const g=b.mouseEnter,v=b.mouseLeave;b.mouseEnter=function(){return g(...arguments),b.mouseOver(...arguments)},b.mouseLeave=function(){return v(...arguments),b.mouseOut(...arguments)};const w=b.pointerEnter,R=b.pointerLeave;b.pointerEnter=function(){return w(...arguments),b.pointerOver(...arguments)},b.pointerLeave=function(){return R(...arguments),b.pointerOut(...arguments)};const T=b.select;b.select=(e,t)=>{T(e,t),e.focus(),b.keyUp(e,t)};const O=b.blur,C=b.focus;b.blur=function(){return b.focusOut(...arguments),O(...arguments)},b.focus=function(){return b.focusIn(...arguments),C(...arguments)};let j={reactStrictMode:!1};function M(){return{...u.getConfig(),...j}}u.configure({unstable_advanceTimersWrapper:e=>h(e),asyncWrapper:async e=>{const t=m();y(!1);try{const t=await e();return await new Promise((e=>{setTimeout((()=>{e()}),0),"undefined"==typeof jest||null===jest||!0!==setTimeout._isMockFunction&&!Object.prototype.hasOwnProperty.call(setTimeout,"clock")||jest.advanceTimersByTime(0)})),t}finally{y(t)}},eventWrapper:e=>{let t;return h((()=>{t=e()})),t}});const _=new Set,A=[];function P(e){return M().reactStrictMode?i.createElement(i.StrictMode,null,e):e}function k(e,t){return t?i.createElement(t,null,e):e}function S(e,t){let r,{hydrate:n,onCaughtError:o,onRecoverableError:u,ui:c,wrapper:a}=t;return n?h((()=>{r=s.hydrateRoot(e,P(k(c,a)),{onCaughtError:o,onRecoverableError:u})})):r=s.createRoot(e,{onCaughtError:o,onRecoverableError:u}),{hydrate(){if(!n)throw new Error("Attempted to hydrate a non-hydrateable root. This is a bug in `@testing-library/react`.")},render(e){r.render(e)},unmount(){r.unmount()}}}function I(e){return{hydrate(t){l.default.hydrate(t,e)},render(t){l.default.render(t,e)},unmount(){l.default.unmountComponentAtNode(e)}}}function L(e,t){let{baseElement:r,container:n,hydrate:o,queries:c,root:a,wrapper:i}=t;return h((()=>{o?a.hydrate(P(k(e,i)),n):a.render(P(k(e,i)),n)})),{container:n,baseElement:r,debug:function(e,t,n){return void 0===e&&(e=r),Array.isArray(e)?e.forEach((e=>console.log(u.prettyDOM(e,t,n)))):console.log(u.prettyDOM(e,t,n))},unmount:()=>{h((()=>{a.unmount()}))},rerender:e=>{L(e,{container:n,baseElement:r,root:a,wrapper:i})},asFragment:()=>{if("function"==typeof document.createRange)return document.createRange().createContextualFragment(n.innerHTML);{const e=document.createElement("template");return e.innerHTML=n.innerHTML,e.content}},...u.getQueriesForElement(r,c)}}function N(e,t){let r,{container:n,baseElement:o=n,legacyRoot:u=!1,onCaughtError:c,onUncaughtError:a,onRecoverableError:i,queries:f,hydrate:s=!1,wrapper:d}=void 0===t?{}:t;if(void 0!==a)throw new Error("onUncaughtError is not supported. The `render` call will already throw on uncaught errors.");if(u&&"function"!=typeof l.default.render){const e=new Error("`legacyRoot: true` is not supported in this version of React. If your app runs React 19 or later, you should remove this flag. If your app runs React 18 or earlier, visit https://react.dev/blog/2022/03/08/react-18-upgrade-guide for upgrade instructions.");throw Error.captureStackTrace(e,N),e}if(o||(o=document.body),n||(n=o.appendChild(document.createElement("div"))),_.has(n))A.forEach((e=>{e.container===n&&(r=e.root)}));else{r=(u?I:S)(n,{hydrate:s,onCaughtError:c,onRecoverableError:i,ui:e,wrapper:d}),A.push({container:n,root:r}),_.add(n)}return L(e,{container:n,baseElement:o,queries:f,hydrate:s,wrapper:d,root:r})}function q(){A.forEach((e=>{let{root:t,container:r}=e;h((()=>{t.unmount()})),r.parentNode===document.body&&document.body.removeChild(r)})),A.length=0,_.clear()}if(("undefined"==typeof process||!process.env?.RTL_SKIP_AUTO_CLEANUP)&&("function"==typeof afterEach?afterEach((()=>{q()})):"function"==typeof teardown&&teardown((()=>{q()})),"function"==typeof beforeAll&&"function"==typeof afterAll)){let e=m();beforeAll((()=>{e=m(),y(!0)})),afterAll((()=>{y(e)}))}e.act=h,e.cleanup=q,e.configure=function(e){"function"==typeof e&&(e=e(M()));const{reactStrictMode:t,...r}=e;u.configure(r),j={...j,reactStrictMode:t}},e.fireEvent=b,e.getConfig=M,e.render=N,e.renderHook=function e(t,r){void 0===r&&(r={});const{initialProps:n,...o}=r;if(o.legacyRoot&&"function"!=typeof l.default.render){const t=new Error("`legacyRoot: true` is not supported in this version of React. If your app runs React 19 or later, you should remove this flag. If your app runs React 18 or earlier, visit https://react.dev/blog/2022/03/08/react-18-upgrade-guide for upgrade instructions.");throw Error.captureStackTrace(t,e),t}const u=i.createRef();function c(e){let{renderCallbackProps:r}=e;const n=t(r);return i.useEffect((()=>{u.current=n})),null}const{rerender:a,unmount:f}=N(i.createElement(c,{renderCallbackProps:n}),o);return{result:u,rerender:function(e){return a(i.createElement(c,{renderCallbackProps:e}))},unmount:f}},Object.keys(u).forEach((function(t){"default"===t||e.hasOwnProperty(t)||Object.defineProperty(e,t,{enumerable:!0,get:function(){return u[t]}})})),Object.defineProperty(e,"__esModule",{value:!0})}));
//# sourceMappingURL=react.umd.min.js.map

@@ -132,2 +132,4 @@ "use strict";

hydrate,
onCaughtError,
onRecoverableError,
ui,

@@ -139,6 +141,12 @@ wrapper: WrapperComponent

(0, _actCompat.default)(() => {
root = ReactDOMClient.hydrateRoot(container, strictModeIfNeeded(wrapUiIfNeeded(ui, WrapperComponent)));
root = ReactDOMClient.hydrateRoot(container, strictModeIfNeeded(wrapUiIfNeeded(ui, WrapperComponent)), {
onCaughtError,
onRecoverableError
});
});
} else {
root = ReactDOMClient.createRoot(container);
root = ReactDOMClient.createRoot(container, {
onCaughtError,
onRecoverableError
});
}

@@ -229,2 +237,5 @@ return {

legacyRoot = false,
onCaughtError,
onUncaughtError,
onRecoverableError,
queries,

@@ -234,2 +245,5 @@ hydrate = false,

} = {}) {
if (onUncaughtError !== undefined) {
throw new Error('onUncaughtError is not supported. The `render` call will already throw on uncaught errors.');
}
if (legacyRoot && typeof _reactDom.default.render !== 'function') {

@@ -254,2 +268,4 @@ const error = new Error('`legacyRoot: true` is not supported in this version of React. ' + 'If your app runs React 19 or later, you should remove this flag. ' + 'If your app runs React 18 or earlier, visit https://react.dev/blog/2022/03/08/react-18-upgrade-guide for upgrade instructions.');

hydrate,
onCaughtError,
onRecoverableError,
ui,

@@ -256,0 +272,0 @@ wrapper

{
"name": "@testing-library/react",
"version": "16.1.0",
"version": "16.2.0",
"description": "Simple and complete React DOM testing utilities that encourage good testing practices.",

@@ -61,3 +61,3 @@ "main": "dist/index.js",

"react": "^18.3.1",
"react-dom": "^18.3.0",
"react-dom": "^18.3.1",
"rimraf": "^3.0.2",

@@ -64,0 +64,0 @@ "typescript": "^4.1.2"

@@ -123,2 +123,26 @@ // TypeScript Version: 3.8

/**
* Only supported in React 19.
* Callback called when React catches an error in an Error Boundary.
* Called with the error caught by the Error Boundary, and an `errorInfo` object containing the `componentStack`.
*
* @see {@link https://react.dev/reference/react-dom/client/createRoot#parameters createRoot#options}
*/
onCaughtError?: ReactDOMClient.RootOptions extends {
onCaughtError: infer OnCaughtError
}
? OnCaughtError
: never
/**
* Callback called when React automatically recovers from errors.
* Called with an error React throws, and an `errorInfo` object containing the `componentStack`.
* Some recoverable errors may include the original error cause as `error.cause`.
*
* @see {@link https://react.dev/reference/react-dom/client/createRoot#parameters createRoot#options}
*/
onRecoverableError?: ReactDOMClient.RootOptions['onRecoverableError']
/**
* Not supported at the moment
*/
onUncaughtError?: never
/**
* Queries to bind. Overrides the default set from DOM Testing Library unless merged.

@@ -125,0 +149,0 @@ *

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc