You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Whilst my code executes both in the react dev environment, and in a live build, for some bizarre reason I get this error when running jest tests, even the simplest components that contain nothing other than a div and then a bare bones implementation of multiselect-react-dropdown will throw this error when trying to create a jest snapshot.
the following errors are observed:
TypeError: Cannot read property 'addEventListener' of null
41 | describe('Check CommentTypeSelector snapshot', () => {
42 | test('Basic snapshot of CommentTypeSelector', () => {
> 43 | const app = renderer.create(<Provider store={store}>
| ^
44 | <div>
45 | <CommentTypeSelector
46 | setCommentTypes={setCommentTypes}
at t.value (node_modules/multiselect-react-dropdown/build/index.js:1:18020)
at commitLifeCycles (node_modules/react-test-renderer/cjs/react-test-renderer.development.js:10428:22)
at commitLayoutEffects (node_modules/react-test-renderer/cjs/react-test-renderer.development.js:13295:7)
at HTMLUnknownElement.callCallback (node_modules/react-test-renderer/cjs/react-test-renderer.development.js:9972:14)
at invokeEventListeners (node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:193:27)
at HTMLUnknownElementImpl._dispatch (node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:119:9)
at HTMLUnknownElementImpl.dispatchEvent (node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:82:17)
at HTMLUnknownElementImpl.dispatchEvent (node_modules/jsdom/lib/jsdom/living/nodes/HTMLElement-impl.js:30:27)
at HTMLUnknownElement.dispatchEvent (node_modules/jsdom/lib/jsdom/living/generated/EventTarget.js:157:21)
at Object.invokeGuardedCallbackDev (node_modules/react-test-renderer/cjs/react-test-renderer.development.js:10021:16)
at invokeGuardedCallback (node_modules/react-test-renderer/cjs/react-test-renderer.development.js:10073:31)
at commitRootImpl (node_modules/react-test-renderer/cjs/react-test-renderer.development.js:13033:9)
at unstable_runWithPriority (node_modules/scheduler/cjs/scheduler.development.js:653:12)
at runWithPriority (node_modules/react-test-renderer/cjs/react-test-renderer.development.js:1775:10)
at commitRoot (node_modules/react-test-renderer/cjs/react-test-renderer.development.js:12873:3)
at finishSyncRender (node_modules/react-test-renderer/cjs/react-test-renderer.development.js:12384:3)
at performSyncWorkOnRoot (node_modules/react-test-renderer/cjs/react-test-renderer.development.js:12370:7)
at node_modules/react-test-renderer/cjs/react-test-renderer.development.js:1825:24
at unstable_runWithPriority (node_modules/scheduler/cjs/scheduler.development.js:653:12)
at runWithPriority (node_modules/react-test-renderer/cjs/react-test-renderer.development.js:1775:10)
at flushSyncCallbackQueueImpl (node_modules/react-test-renderer/cjs/react-test-renderer.development.js:1820:7)
at flushSyncCallbackQueue (node_modules/react-test-renderer/cjs/react-test-renderer.development.js:1808:3)
at scheduleUpdateOnFiber (node_modules/react-test-renderer/cjs/react-test-renderer.development.js:11776:9)
at updateContainer (node_modules/react-test-renderer/cjs/react-test-renderer.development.js:14747:3)
at Object.create (node_modules/react-test-renderer/cjs/react-test-renderer.development.js:15455:5)
at Object.test (src/CommentTypeSelector.test.jsx:43:30)
The text was updated successfully, but these errors were encountered:
@srigar I'm still getting this error with version 2.0.25 and jest
/** * @jest-environment jsdom */importrendererfrom'react-test-renderer';import{Multiselect}from'multiselect-react-dropdown';it('multiselect renders',()=>{letstate={options: [{name: 'Option 1',id: 1},{name: 'Option 2',id: 2}]};consttree=renderer.create(<Multiselectoptions={state.options}// Options to display in the dropdowndisplayValue="name"// Property name to display in the dropdown options/>).toJSON();expect(tree).toMatchSnapshot();});
Any help would be much appreciated. The component itself works great with some nice fixes being observed after we upgraded from 1.6 to 2.0.25 :-)
Whilst my code executes both in the react dev environment, and in a live build, for some bizarre reason I get this error when running jest tests, even the simplest components that contain nothing other than a div and then a bare bones implementation of multiselect-react-dropdown will throw this error when trying to create a jest snapshot.
the following errors are observed:
TypeError: Cannot read property 'addEventListener' of null
The text was updated successfully, but these errors were encountered: