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

Jest + React Testing Library error #258

Open
ignashevich opened this issue Jun 30, 2021 · 5 comments
Open

Jest + React Testing Library error #258

ignashevich opened this issue Jun 30, 2021 · 5 comments
Labels
question Further information is requested

Comments

@ignashevich
Copy link

ignashevich commented Jun 30, 2021

Description

Hi!

Trying to test my code with Jest + React Testing Library and getting the error below. Seems it's related to issue #97.

I've seen you made a fix here v0.1.8...v0.1.11#diff-545931490bc9fb7bfb72fcc1db6fbf41916a8b0b67a1ae9289c7a7df84d32424 but I noticed that after source code building process.env.NODE_ENV.toLowerCase() becoming var env="production".toLowerCase(). It means env always asserts to 'production' even in a test environment. You can check this in the latest release https://github.com/alvarotrigo/react-fullpage/releases/tag/0.1.18

              Error: Uncaught [TypeError: Cannot read property 'length' of undefined]
    at reportException (/Use...
              "Error: Uncaught [TypeError: Cannot read property 'length' of undefined]\n    at reportException (/Users/aliaksandrihnashevich/PhpstormProjects/appshell-frontend/node_modules/jsdom/lib/jsdom/living/helpers/runtime-script-errors.js:62:24)\n    at innerInvokeEventListeners (/Users/aliaksandrihnashevich/PhpstormProjects/appshell-frontend/node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:333:9)\n    at invokeEventListeners (/Users/aliaksandrihnashevich/PhpstormProjects/appshell-frontend/node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:274:3)\n    at HTMLUnknownElementImpl._dispatch (/Users/aliaksandrihnashevich/PhpstormProjects/appshell-frontend/node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:221:9)\n    at HTMLUnknownElementImpl.dispatchEvent (/Users/aliaksandrihnashevich/PhpstormProjects/appshell-frontend/node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:94:17)\n    at HTMLUnknownElement.dispatchEvent (/Users/aliaksandrihnashevich/PhpstormProjects/appshell-frontend/node_modules/jsdom/lib/jsdom/living/generated/EventTarget.js:231:34)\n    at Object.invokeGuardedCallbackDev (/Users/aliaksandrihnashevich/PhpstormProjects/appshell-frontend/modules/TraderProgram/node_modules/react-dom/cjs/react-dom.development.js:237:16)\n    at invokeGuardedCallback (/Users/aliaksandrihnashevich/PhpstormProjects/appshell-frontend/modules/TraderProgram/node_modules/react-dom/cjs/react-dom.development.js:292:31)\n    at commitRootImpl (/Users/aliaksandrihnashevich/PhpstormProjects/appshell-frontend/modules/TraderProgram/node_modules/react-dom/cjs/react-dom.development.js:22541:9)\n    at unstable_runWithPriority (/Users/aliaksandrihnashevich/PhpstormProjects/appshell-frontend/modules/TraderProgram/node_modules/scheduler/cjs/scheduler.development.js:653:12)"
              Cannot read property 'length' of undefined...
              {}
              Error: Uncaught [TypeError: Cannot read property 'destroy' of undefined]
    at reportException (/Us...
              "Error: Uncaught [TypeError: Cannot read property 'destroy' of undefined]\n    at reportException (/Users/aliaksandrihnashevich/PhpstormProjects/appshell-frontend/node_modules/jsdom/lib/jsdom/living/helpers/runtime-script-errors.js:62:24)\n    at innerInvokeEventListeners (/Users/aliaksandrihnashevich/PhpstormProjects/appshell-frontend/node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:333:9)\n    at invokeEventListeners (/Users/aliaksandrihnashevich/PhpstormProjects/appshell-frontend/node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:274:3)\n    at HTMLUnknownElementImpl._dispatch (/Users/aliaksandrihnashevich/PhpstormProjects/appshell-frontend/node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:221:9)\n    at HTMLUnknownElementImpl.dispatchEvent (/Users/aliaksandrihnashevich/PhpstormProjects/appshell-frontend/node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:94:17)\n    at HTMLUnknownElement.dispatchEvent (/Users/aliaksandrihnashevich/PhpstormProjects/appshell-frontend/node_modules/jsdom/lib/jsdom/living/generated/EventTarget.js:231:34)\n    at Object.invokeGuardedCallbackDev (/Users/aliaksandrihnashevich/PhpstormProjects/appshell-frontend/modules/TraderProgram/node_modules/react-dom/cjs/react-dom.development.js:237:16)\n    at invokeGuardedCallback (/Users/aliaksandrihnashevich/PhpstormProjects/appshell-frontend/modules/TraderProgram/node_modules/react-dom/cjs/react-dom.development.js:292:31)\n    at safelyCallComponentWillUnmount (/Users/aliaksandrihnashevich/PhpstormProjects/appshell-frontend/modules/TraderProgram/node_modules/react-dom/cjs/react-dom.development.js:19587:5)\n    at commitUnmount (/Users/aliaksandrihnashevich/PhpstormProjects/appshell-frontend/modules/TraderProgram/node_modules/react-dom/cjs/react-dom.development.js:20109:11)"
              Cannot read property 'destroy' of undefined...
              {}
              The above error occurred in the <ReactFullpage> component:
    in ReactFullpage (created by TraderPr...
              "The above error occurred in the <ReactFullpage> component:\n    in ReactFullpage (created by TraderProgramDesktop)\n    in TraderProgramDesktop\n    in div (created by Context.Consumer)\n    in Media\n    in Unknown\n    in Provider\n    in IntlProvider\n    in Unknown\n\nConsider adding an error boundary to your tree to customize error handling behavior.\nVisit https://fb.me/react-error-boundaries to learn more about error boundaries."
              The above error occurred in the <ReactFullpage> component:
    in ReactFullpage (created by TraderPr...
              "The above error occurred in the <ReactFullpage> component:\n    in ReactFullpage (created by TraderProgramDesktop)\n    in TraderProgramDesktop\n    in div (created by Context.Consumer)\n    in Media\n    in Unknown\n    in Provider\n    in IntlProvider\n    in Unknown\n\nConsider adding an error boundary to your tree to customize error handling behavior.\nVisit https://fb.me/react-error-boundaries to learn more about error boundaries."```


Chrome: Version 91.0.4472.114 (Official Build) (x86_64)
MacOS: BigSur
Node: v14.17.0
@alvarotrigo
Copy link
Owner

Would you like to provide a pull request for it ?

@alvarotrigo alvarotrigo added the question Further information is requested label Jun 30, 2021
@ignashevich
Copy link
Author

Would you like to provide a pull request for it ?

Yeah, let me try

@ignashevich
Copy link
Author

Would you like to provide a pull request for it ?

I tried to and haven't managed to fix it 😞

Can you take it?

@alvarotrigo
Copy link
Owner

To be honest I'm not familiar with Jest so I'm a bit lost here too :)

@alvarotrigo
Copy link
Owner

Any idea what can be happening @cmswalker ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants