Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] (Jest): TypeError: Cannot read properties of null (reading 'querySelector') #225

Open
2 tasks done
eifr-vault opened this issue Dec 15, 2022 · 0 comments
Open
2 tasks done
Labels
bug Something isn't working

Comments

@eifr-vault
Copy link

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
@eifr-vault eifr-vault added the bug Something isn't working label Dec 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant