[Bug] (Jest): `TypeError: Cannot read properties of null (reading 'querySelector')`
eifr-vault opened this issue · 0 comments
eifr-vault commented
Is there an existing issue for this?
- I have searched the existing issues
Have you updated React FilePond, FilePond, and all plugins?
- I have updated FilePond and its plugins
Describe the bug
when running the component in jest (using react-test-renderer
) it fails with this issue:
TypeError: Cannot read properties of null (reading 'querySelector')
8 | describe('FileUpload Component', () => {
9 | test('snapshot matches for FileUpload', () => {
> 10 | const tree = create(
| ^
11 | <MemoryRouter>
12 | <ThemeProvider theme={theme}>
13 | <FileUpload
at FilePond.componentDidMount (node_modules/react-filepond/dist/react-filepond.js:71:35)
at commitLifeCycles (node_modules/react-test-renderer/cjs/react-test-renderer.development.js:10428:22)
at apply (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 HTMLUnknownElement.callTheUserObjectsOperation (node_modules/jsdom/lib/jsdom/living/generated/EventListener.js:26:30)
at innerInvokeEventListeners (node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:338:25)
at invokeEventListeners (node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:274:3)
at HTMLUnknownElementImpl._dispatch (node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:221:9)
at HTMLUnknownElementImpl.dispatchEvent (node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:94:17)
at HTMLUnknownElement.dispatchEvent (node_modules/jsdom/lib/jsdom/living/generated/EventTarget.js:231:34)
at Object.apply (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 eventHandler (node_modules/react-test-renderer/cjs/react-test-renderer.development.js:13033:9)
at Scheduler_runWithPriority (node_modules/react-test-renderer/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 callback (node_modules/react-test-renderer/cjs/react-test-renderer.development.js:12370:7)
at eventHandler (node_modules/react-test-renderer/cjs/react-test-renderer.development.js:1825:24)
at Scheduler_runWithPriority (node_modules/react-test-renderer/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 scheduleWork (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 create (node_modules/react-test-renderer/cjs/react-test-renderer.development.js:15455:5)
at Object.<anonymous> (src/components/molecules/FileUpload/FileUpload.test.tsx:10:18)
Reproduction
run <Filepond />
in jest using react-test-renderer
's create function
Environment
- Device:Macos
- OS:13.1
- Browser: chrome 108
- React version: 17.0.2