Skip to content

esturcke/jest-stateless-coverage-bug

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Bug

Jest issue #1824

When mounting a stateless function component with enzyme, the component name is preserved when running jest, but not when running jest --coverage. This is causing unit tests to fail when generating coverage that otherwise succeed.

For example, when mounting the component

const Foo = () => <div>Foo</div>

results in

<Foo>
  <div>
    Foo
  </div>
</Foo>

but when generating coverage, it results in

<Component>
  <div>
    Foo
  </div>
</Component>

Reproducing

Unit tests succeed with:

npm test

They fail with:

npm test -- --coverage

About

🏁 Stateless component loses name when generating coverage

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published