question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Jest --coverage - Nothing was returned from render

See original GitHub issue

When i try to run the jest --coverage it throws following error react-jest-coverage-error

To Reproduce

  1. clone the [repository](https://github.com/gunaerode/intro-to-react-v5/tree/testing repository)
  2. run npm run test:coverage

Expected behavior

Result should come as below screenshot expected-behaviour

Link to repl or repo (highly encouraged)

[repository](https://github.com/gunaerode/intro-to-react-v5/tree/testing repository)

envinfo

Windows 10 react: ^16.13.0 react-dom : ^16.13.0 jest: ^25.2.3

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:6
  • Comments:35 (2 by maintainers)

github_iconTop GitHub Comments

10reactions
tnovaucommented, Apr 4, 2020

Same issue here, with a fresh installation from “create-react-app”

Ubuntu 18.04

  • “react”: “^16.13.1”
  • “react-dom”: “^16.13.1”
  • “react-scripts”: “3.4.1”
  • @testing-library/react”: “^9.3.2”

Workaround:

Downgrade:

  • “react”: “16.13.0”
  • “react-dom”: “16.13.0”
  • “react-scripts”: “3.4.0”
  • @testing-library/react”: “9.3.2”

And it will work 🎉

6reactions
jjercxcommented, Apr 30, 2020

valid tests fail if run with the --coverage flag. I’m using create-react-app, same versions but in Mac OSX. Downgrading works!

Same issue here, with a fresh installation from “create-react-app”

Ubuntu 18.04

  • “react”: “^16.13.1”
  • “react-dom”: “^16.13.1”
  • “react-scripts”: “3.4.1”
  • @testing-library/react”: “^9.3.2”

Workaround:

Downgrade:

  • “react”: “16.13.0”
  • “react-dom”: “16.13.0”
  • “react-scripts”: “3.4.0”
  • @testing-library/react”: “9.3.2”

And it will work 🎉

Read more comments on GitHub >

github_iconTop Results From Across the Web

Jest --coverage tests error: 'Nothing was returned from render.'
Nothing was returned from render. This usually means a return statement is missing. Or, to render nothing, return null.]
Read more >
Nothing was returned from render Error in React [Solved]
The "Nothing was returned from render" React error occurs when we forget to explicitly return a value from a function or class component....
Read more >
React testing-library Nothing was returned from render
Nothing was returned from render. This usually means a return statement is missing. Or, to render nothing, return null. This warning happens when...
Read more >
test --coverage throwing "Nothing was returned from render ...
Coding example for the question test --coverage throwing "Nothing was returned from render." error-Reactjs.
Read more >
React testing library (Nothing was returned from render.)
import React from "react"; import { render } from "@testing-library/react"; import { Form } from "../../components"; jest.mock("react-router-dom ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Hashnode Post

No results found