Jest --coverage - Nothing was returned from render
See original GitHub issueWhen i try to run the jest --coverage it throws following error
To Reproduce
- clone the [repository](https://github.com/gunaerode/intro-to-react-v5/tree/testing repository)
- run
npm run test:coverage
Expected behavior
Result should come as below screenshot
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:
- Created 3 years ago
- Reactions:6
- Comments:35 (2 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
Top Related Hashnode Post
No results found

Same issue here, with a fresh installation from “create-react-app”
Ubuntu 18.04
Workaround:
Downgrade:
And it will work 🎉
valid tests fail if run with the
--coverageflag. I’m usingcreate-react-app, same versions but in Mac OSX. Downgrading works!