Skip to content
New issue

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

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

Already on GitHub? # to your account

jest coverage currently failing [testing branch - newer versions of deps] #85

Open
alessioalex opened this issue Mar 27, 2020 · 0 comments

Comments

@alessioalex
Copy link

alessioalex commented Mar 27, 2020

Note: you should probably be ok if you're using the dependencies from the testing branch and not following along with the video tutorial from frontendmasters (by than I mean manually running npm i <new_testing_modules>.

Apparently it's a known issue happening in the last week or so:

facebook/create-react-app#8689

> jest --coverage

 FAIL  src/__test__/SearchParams.test.js
  ✕ SearchParams (22ms)

  ● SearchParams

    SearchParams(...): Nothing was returned from render. This usually means a return statement is missing. Or, to render nothing, return null.

       7 | 
       8 | test("SearchParams", async () => {
    >  9 |   const { getByTestId, container, getByText } = render(<SearchParams />);
         |                                                 ^
      10 | 
      11 |   const animalDropdown = getByTestId("use-dropdown-animal");
      12 |   expect(animalDropdown.children.length).toEqual(ANIMALS.length + 1);

      at reconcileChildFibers (node_modules/react-dom/cjs/react-dom.development.js:14348:23)
      at reconcileChildren (node_modules/react-dom/cjs/react-dom.development.js:16762:28)
      at mountIndeterminateComponent (node_modules/react-dom/cjs/react-dom.development.js:17542:5)
      at beginWork (node_modules/react-dom/cjs/react-dom.development.js:18596:16)
      at HTMLUnknownElement.callCallback (node_modules/react-dom/cjs/react-dom.development.js:188:14)
      at innerInvokeEventListeners (node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:316:27)
      at invokeEventListeners (node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:267:3)
      at HTMLUnknownElementImpl._dispatch (node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:214:9)
      at HTMLUnknownElementImpl.dispatchEvent (node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:87:17)
      at HTMLUnknownElement.dispatchEvent (node_modules/jsdom/lib/jsdom/living/generated/EventTarget.js:144:23)
      at Object.invokeGuardedCallbackDev (node_modules/react-dom/cjs/react-dom.development.js:237:16)
      at invokeGuardedCallback (node_modules/react-dom/cjs/react-dom.development.js:292:31)
      at beginWork$1 (node_modules/react-dom/cjs/react-dom.development.js:23203:7)
      at performUnitOfWork (node_modules/react-dom/cjs/react-dom.development.js:22157:12)
      at workLoopSync (node_modules/react-dom/cjs/react-dom.development.js:22130:22)
      at performSyncWorkOnRoot (node_modules/react-dom/cjs/react-dom.development.js:21756:9)
      at scheduleUpdateOnFiber (node_modules/react-dom/cjs/react-dom.development.js:21188:7)
      at updateContainer (node_modules/react-dom/cjs/react-dom.development.js:24373:3)
      at node_modules/react-dom/cjs/react-dom.development.js:24758:7
      at unbatchedUpdates (node_modules/react-dom/cjs/react-dom.development.js:21903:12)
      at legacyRenderSubtreeIntoContainer (node_modules/react-dom/cjs/react-dom.development.js:24757:5)
      at Object.render (node_modules/react-dom/cjs/react-dom.development.js:24840:10)
      at node_modules/@testing-library/react/dist/pure.js:86:25
      at batchedUpdates$1 (node_modules/react-dom/cjs/react-dom.development.js:21856:12)
      at act (node_modules/react-dom/cjs/react-dom-test-utils.development.js:929:14)
      at render (node_modules/@testing-library/react/dist/pure.js:82:26)
      at Object.<anonymous>.test (src/__test__/SearchParams.test.js:9:49)

  console.error node_modules/jsdom/lib/jsdom/virtual-console.js:29
    Error: Uncaught [Error: SearchParams(...): Nothing was returned from render. This usually means a return statement is missing. Or, to render nothing, return null.]
        at reportException (/home/alexandru/www/react-fem/adopt-me/node_modules/jsdom/lib/jsdom/living/helpers/runtime-script-errors.js:62:24)
        at innerInvokeEventListeners (/home/alexandru/www/react-fem/adopt-me/node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:332:9)
        at invokeEventListeners (/home/alexandru/www/react-fem/adopt-me/node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:267:3)
        at HTMLUnknownElementImpl._dispatch (/home/alexandru/www/react-fem/adopt-me/node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:214:9)
        at HTMLUnknownElementImpl.dispatchEvent (/home/alexandru/www/react-fem/adopt-me/node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:87:17)
        at HTMLUnknownElement.dispatchEvent (/home/alexandru/www/react-fem/adopt-me/node_modules/jsdom/lib/jsdom/living/generated/EventTarget.js:144:23)
        at Object.invokeGuardedCallbackDev (/home/alexandru/www/react-fem/adopt-me/node_modules/react-dom/cjs/react-dom.development.js:237:16)
        at invokeGuardedCallback (/home/alexandru/www/react-fem/adopt-me/node_modules/react-dom/cjs/react-dom.development.js:292:31)
        at beginWork$1 (/home/alexandru/www/react-fem/adopt-me/node_modules/react-dom/cjs/react-dom.development.js:23203:7)
        at performUnitOfWork (/home/alexandru/www/react-fem/adopt-me/node_modules/react-dom/cjs/react-dom.development.js:22157:12) Error: SearchParams(...): Nothing was returned from render. This usually means a return statement is missing. Or, to render nothing, return null.
        at reconcileChildFibers (/home/alexandru/www/react-fem/adopt-me/node_modules/react-dom/cjs/react-dom.development.js:14348:23)
        at reconcileChildren (/home/alexandru/www/react-fem/adopt-me/node_modules/react-dom/cjs/react-dom.development.js:16762:28)
        at mountIndeterminateComponent (/home/alexandru/www/react-fem/adopt-me/node_modules/react-dom/cjs/react-dom.development.js:17542:5)
        at beginWork (/home/alexandru/www/react-fem/adopt-me/node_modules/react-dom/cjs/react-dom.development.js:18596:16)
        at HTMLUnknownElement.callCallback (/home/alexandru/www/react-fem/adopt-me/node_modules/react-dom/cjs/react-dom.development.js:188:14)
        at innerInvokeEventListeners (/home/alexandru/www/react-fem/adopt-me/node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:316:27)
        at invokeEventListeners (/home/alexandru/www/react-fem/adopt-me/node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:267:3)
        at HTMLUnknownElementImpl._dispatch (/home/alexandru/www/react-fem/adopt-me/node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:214:9)
        at HTMLUnknownElementImpl.dispatchEvent (/home/alexandru/www/react-fem/adopt-me/node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:87:17)
        at HTMLUnknownElement.dispatchEvent (/home/alexandru/www/react-fem/adopt-me/node_modules/jsdom/lib/jsdom/living/generated/EventTarget.js:144:23)
        at Object.invokeGuardedCallbackDev (/home/alexandru/www/react-fem/adopt-me/node_modules/react-dom/cjs/react-dom.development.js:237:16)
        at invokeGuardedCallback (/home/alexandru/www/react-fem/adopt-me/node_modules/react-dom/cjs/react-dom.development.js:292:31)
        at beginWork$1 (/home/alexandru/www/react-fem/adopt-me/node_modules/react-dom/cjs/react-dom.development.js:23203:7)
        at performUnitOfWork (/home/alexandru/www/react-fem/adopt-me/node_modules/react-dom/cjs/react-dom.development.js:22157:12)
        at workLoopSync (/home/alexandru/www/react-fem/adopt-me/node_modules/react-dom/cjs/react-dom.development.js:22130:22)
        at performSyncWorkOnRoot (/home/alexandru/www/react-fem/adopt-me/node_modules/react-dom/cjs/react-dom.development.js:21756:9)
        at scheduleUpdateOnFiber (/home/alexandru/www/react-fem/adopt-me/node_modules/react-dom/cjs/react-dom.development.js:21188:7)
        at updateContainer (/home/alexandru/www/react-fem/adopt-me/node_modules/react-dom/cjs/react-dom.development.js:24373:3)
        at /home/alexandru/www/react-fem/adopt-me/node_modules/react-dom/cjs/react-dom.development.js:24758:7
        at unbatchedUpdates (/home/alexandru/www/react-fem/adopt-me/node_modules/react-dom/cjs/react-dom.development.js:21903:12)
        at legacyRenderSubtreeIntoContainer (/home/alexandru/www/react-fem/adopt-me/node_modules/react-dom/cjs/react-dom.development.js:24757:5)
        at Object.render (/home/alexandru/www/react-fem/adopt-me/node_modules/react-dom/cjs/react-dom.development.js:24840:10)
        at /home/alexandru/www/react-fem/adopt-me/node_modules/@testing-library/react/dist/pure.js:86:25
        at batchedUpdates$1 (/home/alexandru/www/react-fem/adopt-me/node_modules/react-dom/cjs/react-dom.development.js:21856:12)
        at act (/home/alexandru/www/react-fem/adopt-me/node_modules/react-dom/cjs/react-dom-test-utils.development.js:929:14)
        at render (/home/alexandru/www/react-fem/adopt-me/node_modules/@testing-library/react/dist/pure.js:82:26)
        at Object.<anonymous>.test (/home/alexandru/www/react-fem/adopt-me/src/__test__/SearchParams.test.js:9:49)
        at Object.asyncJestTest (/home/alexandru/www/react-fem/adopt-me/node_modules/jest-jasmine2/build/jasmineAsyncInstall.js:100:37)
        at resolve (/home/alexandru/www/react-fem/adopt-me/node_modules/jest-jasmine2/build/queueRunner.js:45:12)
        at new Promise (<anonymous>)
        at mapper (/home/alexandru/www/react-fem/adopt-me/node_modules/jest-jasmine2/build/queueRunner.js:28:19)
        at promise.then (/home/alexandru/www/react-fem/adopt-me/node_modules/jest-jasmine2/build/queueRunner.js:75:41)

  console.error node_modules/react-dom/cjs/react-dom.development.js:19527
    The above error occurred in the <SearchParams> component:
        in SearchParams
    
    Consider adding an error boundary to your tree to customize error handling behavior.
    Visit https://fb.me/react-error-boundaries to learn more about error boundaries.

-----------------|---------|----------|---------|---------|----------------------------------
File             | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s                
-----------------|---------|----------|---------|---------|----------------------------------
All files        |   41.03 |        0 |   10.53 |   42.11 |                                  
 Pet.js          |       0 |        0 |       0 |       0 | 5,7,8,11                         
 Results.js      |   33.33 |        0 |       0 |   33.33 | 5,11                             
 SearchParams.js |   40.91 |        0 |      10 |   42.86 | 17,24,40,41,43-45,57,58,67,78,79 
 ThemeContext.js |     100 |      100 |       0 |     100 |                                  
 useDropdown.js  |   55.56 |      100 |      20 |   55.56 | 8,14,15,20                       
-----------------|---------|----------|---------|---------|----------------------------------
Test Suites: 1 failed, 1 total
Tests:       1 failed, 1 total
Snapshots:   0 total
Time:        1.091s
Ran all test suites.
@alessioalex alessioalex changed the title jest coverage currently failing jest coverage currently failing [testing branch - newer versions of deps] Mar 27, 2020
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant