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
Testing Framework and version: Jest (Create-React-App Latest)
DOM Environment: jsdom (Create-React-App Latest)
What you did:
I'm trying to run my tests in Github Actions, which as worked fine previously in other projects using this script: react-scripts test --coverage --watchAll=false --coverageDirectory='jest-coverage'.
However, for some reason I am getting strange errors in my latest project, and I have been struggling for days to figure out what is going wrong. For some reason ALL OF MY TESTS FAIL
even though when I run these tests locally they all pass.
This issue does not occur when I remove the --coverage flag
What happened:
2020-05-14T22:33:15.3225656Z FAIL src/components/shared/FormInput.test.js
2020-05-14T22:33:15.3231735Z â—� Console
2020-05-14T22:33:15.3232295Z
2020-05-14T22:33:15.3233364Z console.error node_modules/jest-environment-jsdom/node_modules/jsdom/lib/jsdom/virtual-console.js:29
2020-05-14T22:33:15.3234230Z Error: Uncaught [Error: FormInput(...): Nothing was returned from render. This usually means a return statement is missing. Or, to render nothing, return null.]
2020-05-14T22:33:15.3235573Z at reportException (/home/runner/work/cra-template-crows/cra-template-crows/test-app/node_modules/jest-environment-jsdom/node_modules/jsdom/lib/jsdom/living/helpers/runtime-script-errors.js:66:24)
2020-05-14T22:33:15.3236931Z at invokeEventListeners (/home/runner/work/cra-template-crows/cra-template-crows/test-app/node_modules/jest-environment-jsdom/node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:209:9)
2020-05-14T22:33:15.3238757Z at HTMLUnknownElementImpl._dispatch (/home/runner/work/cra-template-crows/cra-template-crows/test-app/node_modules/jest-environment-jsdom/node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:119:9)
2020-05-14T22:33:15.3240167Z at HTMLUnknownElementImpl.dispatchEvent (/home/runner/work/cra-template-crows/cra-template-crows/test-app/node_modules/jest-environment-jsdom/node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:82:17)
2020-05-14T22:33:15.3241661Z at HTMLUnknownElementImpl.dispatchEvent (/home/runner/work/cra-template-crows/cra-template-crows/test-app/node_modules/jest-environment-jsdom/node_modules/jsdom/lib/jsdom/living/nodes/HTMLElement-impl.js:30:27)
2020-05-14T22:33:15.3242998Z at HTMLUnknownElement.dispatchEvent (/home/runner/work/cra-template-crows/cra-template-crows/test-app/node_modules/jest-environment-jsdom/node_modules/jsdom/lib/jsdom/living/generated/EventTarget.js:157:21)
2020-05-14T22:33:15.3244261Z at Object.invokeGuardedCallbackDev (/home/runner/work/cra-template-crows/cra-template-crows/test-app/node_modules/react-dom/cjs/react-dom.development.js:237:16)
2020-05-14T22:33:15.3245759Z at invokeGuardedCallback (/home/runner/work/cra-template-crows/cra-template-crows/test-app/node_modules/react-dom/cjs/react-dom.development.js:292:31)
2020-05-14T22:33:15.3246999Z at beginWork$1 (/home/runner/work/cra-template-crows/cra-template-crows/test-app/node_modules/react-dom/cjs/react-dom.development.js:23203:7)
2020-05-14T22:33:15.3248504Z at performUnitOfWork (/home/runner/work/cra-template-crows/cra-template-crows/test-app/node_modules/react-dom/cjs/react-dom.development.js:22157:12) Error: FormInput(...): Nothing was returned from render. This usually means a return statement is missing. Or, to render nothing, return null.
2020-05-14T22:33:15.3249790Z at reconcileChildFibers (/home/runner/work/cra-template-crows/cra-template-crows/test-app/node_modules/react-dom/cjs/react-dom.development.js:14348:23)
2020-05-14T22:33:15.3251027Z at reconcileChildren (/home/runner/work/cra-template-crows/cra-template-crows/test-app/node_modules/react-dom/cjs/react-dom.development.js:16762:28)
2020-05-14T22:33:15.3252479Z at mountIndeterminateComponent (/home/runner/work/cra-template-crows/cra-template-crows/test-app/node_modules/react-dom/cjs/react-dom.development.js:17542:5)
2020-05-14T22:33:15.3255232Z at beginWork (/home/runner/work/cra-template-crows/cra-template-crows/test-app/node_modules/react-dom/cjs/react-dom.development.js:18596:16)
2020-05-14T22:33:15.3256452Z at HTMLUnknownElement.callCallback (/home/runner/work/cra-template-crows/cra-template-crows/test-app/node_modules/react-dom/cjs/react-dom.development.js:188:14)
2020-05-14T22:33:15.3257660Z at invokeEventListeners (/home/runner/work/cra-template-crows/cra-template-crows/test-app/node_modules/jest-environment-jsdom/node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:193:27)
2020-05-14T22:33:15.3258909Z at HTMLUnknownElementImpl._dispatch (/home/runner/work/cra-template-crows/cra-template-crows/test-app/node_modules/jest-environment-jsdom/node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:119:9)
2020-05-14T22:33:15.3260164Z at HTMLUnknownElementImpl.dispatchEvent (/home/runner/work/cra-template-crows/cra-template-crows/test-app/node_modules/jest-environment-jsdom/node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:82:17)
2020-05-14T22:33:15.3261399Z at HTMLUnknownElementImpl.dispatchEvent (/home/runner/work/cra-template-crows/cra-template-crows/test-app/node_modules/jest-environment-jsdom/node_modules/jsdom/lib/jsdom/living/nodes/HTMLElement-impl.js:30:27)
2020-05-14T22:33:15.3262810Z at HTMLUnknownElement.dispatchEvent (/home/runner/work/cra-template-crows/cra-template-crows/test-app/node_modules/jest-environment-jsdom/node_modules/jsdom/lib/jsdom/living/generated/EventTarget.js:157:21)
2020-05-14T22:33:15.3264117Z at Object.invokeGuardedCallbackDev (/home/runner/work/cra-template-crows/cra-template-crows/test-app/node_modules/react-dom/cjs/react-dom.development.js:237:16)
2020-05-14T22:33:15.3265213Z at invokeGuardedCallback (/home/runner/work/cra-template-crows/cra-template-crows/test-app/node_modules/react-dom/cjs/react-dom.development.js:292:31)
2020-05-14T22:33:15.3266278Z at beginWork$1 (/home/runner/work/cra-template-crows/cra-template-crows/test-app/node_modules/react-dom/cjs/react-dom.development.js:23203:7)
2020-05-14T22:33:15.3267328Z at performUnitOfWork (/home/runner/work/cra-template-crows/cra-template-crows/test-app/node_modules/react-dom/cjs/react-dom.development.js:22157:12)
2020-05-14T22:33:15.3268363Z at workLoopSync (/home/runner/work/cra-template-crows/cra-template-crows/test-app/node_modules/react-dom/cjs/react-dom.development.js:22130:22)
2020-05-14T22:33:15.3269433Z at performSyncWorkOnRoot (/home/runner/work/cra-template-crows/cra-template-crows/test-app/node_modules/react-dom/cjs/react-dom.development.js:21756:9)
2020-05-14T22:33:15.3270486Z at scheduleUpdateOnFiber (/home/runner/work/cra-template-crows/cra-template-crows/test-app/node_modules/react-dom/cjs/react-dom.development.js:21188:7)
2020-05-14T22:33:15.3271541Z at updateContainer (/home/runner/work/cra-template-crows/cra-template-crows/test-app/node_modules/react-dom/cjs/react-dom.development.js:24373:3)
2020-05-14T22:33:15.3272569Z at /home/runner/work/cra-template-crows/cra-template-crows/test-app/node_modules/react-dom/cjs/react-dom.development.js:24758:7
2020-05-14T22:33:15.3273627Z at unbatchedUpdates (/home/runner/work/cra-template-crows/cra-template-crows/test-app/node_modules/react-dom/cjs/react-dom.development.js:21903:12)
2020-05-14T22:33:15.3274727Z at legacyRenderSubtreeIntoContainer (/home/runner/work/cra-template-crows/cra-template-crows/test-app/node_modules/react-dom/cjs/react-dom.development.js:24757:5)
2020-05-14T22:33:15.3275808Z at Object.render (/home/runner/work/cra-template-crows/cra-template-crows/test-app/node_modules/react-dom/cjs/react-dom.development.js:24840:10)
2020-05-14T22:33:15.3276832Z at /home/runner/work/cra-template-crows/cra-template-crows/test-app/node_modules/@testing-library/react/dist/pure.js:86:25
2020-05-14T22:33:15.3277814Z at batchedUpdates$1 (/home/runner/work/cra-template-crows/cra-template-crows/test-app/node_modules/react-dom/cjs/react-dom.development.js:21856:12)
2020-05-14T22:33:15.3278440Z at act (/home/runner/work/cra-template-crows/cra-template-crows/test-app/node_modules/react-dom/cjs/react-dom-test-utils.development.js:929:14)
2020-05-14T22:33:15.3279080Z at render (/home/runner/work/cra-template-crows/cra-template-crows/test-app/node_modules/@testing-library/react/dist/pure.js:82:26)
2020-05-14T22:33:15.3279669Z at Object.<anonymous> (/home/runner/work/cra-template-crows/cra-template-crows/test-app/src/components/shared/FormInput.test.js:14:3)
2020-05-14T22:33:15.3280294Z at Object.asyncJestTest (/home/runner/work/cra-template-crows/cra-template-crows/test-app/node_modules/jest-jasmine2/build/jasmineAsyncInstall.js:102:37)
2020-05-14T22:33:15.3280900Z at /home/runner/work/cra-template-crows/cra-template-crows/test-app/node_modules/jest-jasmine2/build/queueRunner.js:43:12
2020-05-14T22:33:15.3281180Z at new Promise (<anonymous>)
2020-05-14T22:33:15.3281729Z at mapper (/home/runner/work/cra-template-crows/cra-template-crows/test-app/node_modules/jest-jasmine2/build/queueRunner.js:26:19)
2020-05-14T22:33:15.3282301Z at /home/runner/work/cra-template-crows/cra-template-crows/test-app/node_modules/jest-jasmine2/build/queueRunner.js:73:41
2020-05-14T22:33:15.3282806Z console.error node_modules/react-dom/cjs/react-dom.development.js:19527
2020-05-14T22:33:15.3283156Z The above error occurred in the <FormInput> component:
2020-05-14T22:33:15.3283406Z in FormInput (at FormInput.test.js:16)
2020-05-14T22:33:15.3283651Z in ThemeProvider (created by ThemeProvider)
2020-05-14T22:33:15.3283895Z in ThemeProvider (at FormInput.test.js:15)
2020-05-14T22:33:15.3284128Z
2020-05-14T22:33:15.3284372Z Consider adding an error boundary to your tree to customize error handling behavior.
2020-05-14T22:33:15.3284916Z Visit https://fb.me/react-error-boundaries to learn more about error boundaries.
2020-05-14T22:33:15.3285146Z
2020-05-14T22:33:15.3285892Z â—� renders form input and allows you to set input and provide placeholders
2020-05-14T22:33:15.3286126Z
2020-05-14T22:33:15.3286479Z FormInput(...): Nothing was returned from render. This usually means a return statement is missing. Or, to render nothing, return null.
2020-05-14T22:33:15.3286682Z
2020-05-14T22:33:15.3286906Z 12 | });
2020-05-14T22:33:15.3287130Z 13 |
2020-05-14T22:33:15.3287459Z > 14 | render(
2020-05-14T22:33:15.3287685Z | ^
2020-05-14T22:33:15.3288147Z 15 | <ThemeProvider>
2020-05-14T22:33:15.3288408Z 16 | <FormInput
2020-05-14T22:33:15.3288675Z 17 | label="Name"
2020-05-14T22:33:15.3288863Z
2020-05-14T22:33:15.3289468Z at reconcileChildFibers (node_modules/react-dom/cjs/react-dom.development.js:14348:23)
2020-05-14T22:33:15.3289981Z at reconcileChildren (node_modules/react-dom/cjs/react-dom.development.js:16762:28)
2020-05-14T22:33:15.3291871Z at mountIndeterminateComponent (node_modules/react-dom/cjs/react-dom.development.js:17542:5)
2020-05-14T22:33:15.3292249Z at beginWork (node_modules/react-dom/cjs/react-dom.development.js:18596:16)
2020-05-14T22:33:15.3292632Z at HTMLUnknownElement.callCallback (node_modules/react-dom/cjs/react-dom.development.js:188:14)
2020-05-14T22:33:15.3293023Z at Object.invokeGuardedCallbackDev (node_modules/react-dom/cjs/react-dom.development.js:237:16)
2020-05-14T22:33:15.3293409Z at invokeGuardedCallback (node_modules/react-dom/cjs/react-dom.development.js:292:31)
2020-05-14T22:33:15.3293775Z at beginWork$1 (node_modules/react-dom/cjs/react-dom.development.js:23203:7)
2020-05-14T22:33:15.3294142Z at performUnitOfWork (node_modules/react-dom/cjs/react-dom.development.js:22157:12)
2020-05-14T22:33:15.3294604Z at workLoopSync (node_modules/react-dom/cjs/react-dom.development.js:22130:22)
2020-05-14T22:33:15.3294990Z at performSyncWorkOnRoot (node_modules/react-dom/cjs/react-dom.development.js:21756:9)
2020-05-14T22:33:15.3295367Z at scheduleUpdateOnFiber (node_modules/react-dom/cjs/react-dom.development.js:21188:7)
2020-05-14T22:33:15.3295736Z at updateContainer (node_modules/react-dom/cjs/react-dom.development.js:24373:3)
2020-05-14T22:33:15.3296070Z at node_modules/react-dom/cjs/react-dom.development.js:24758:7
2020-05-14T22:33:15.3296437Z at unbatchedUpdates (node_modules/react-dom/cjs/react-dom.development.js:21903:12)
2020-05-14T22:33:15.3296836Z at legacyRenderSubtreeIntoContainer (node_modules/react-dom/cjs/react-dom.development.js:24757:5)
2020-05-14T22:33:15.3297210Z at Object.render (node_modules/react-dom/cjs/react-dom.development.js:24840:10)
2020-05-14T22:33:15.3297550Z at node_modules/@testing-library/react/dist/pure.js:86:25
2020-05-14T22:33:15.3297922Z at batchedUpdates$1 (node_modules/react-dom/cjs/react-dom.development.js:21856:12)
2020-05-14T22:33:15.3298292Z at act (node_modules/react-dom/cjs/react-dom-test-utils.development.js:929:14)
2020-05-14T22:33:15.3298636Z at render (node_modules/@testing-library/react/dist/pure.js:82:26)
2020-05-14T22:33:15.3298792Z at Object.<anonymous> (src/components/shared/FormInput.test.js:14:3)
For some reason, when running tests with coverage mode enabled, only on Github Actions (not locally) my tests will fail for the reason that my elements returned nothing, even though they work properly.
The text was updated successfully, but these errors were encountered:
Update: Fixed the issue. Problem was that on CI, Create-React-App was defaulting to yarn, which messed up an install somehow, which did not happen on my local machine as I do not have yarn installed.
@testing-library/react
version: ^10.0.2Testing Framework and version: Jest (Create-React-App Latest)
DOM Environment: jsdom (Create-React-App Latest)
What you did:
I'm trying to run my tests in Github Actions, which as worked fine previously in other projects using this script:
react-scripts test --coverage --watchAll=false --coverageDirectory='jest-coverage'
.However, for some reason I am getting strange errors in my latest project, and I have been struggling for days to figure out what is going wrong. For some reason ALL OF MY TESTS FAIL
even though when I run these tests locally they all pass.
This issue does not occur when I remove the
--coverage
flagWhat happened:
Reproduction:
The a run with logs where this error occurred:
https://github.com/TransmissionsDev/cra-template-crows/runs/676226310?check_suite_focus=true
Workflow configs:
https://github.com/TransmissionsDev/cra-template-crows/blob/master/.github/workflows/tests.yml
Tests:
https://github.com/TransmissionsDev/cra-template-crows/blob/master/template/src/components/shared/FormInput.test.js
Problem description:
For some reason, when running tests with coverage mode enabled, only on Github Actions (not locally) my tests will fail for the reason that my elements returned nothing, even though they work properly.
The text was updated successfully, but these errors were encountered: