Although this is not a direct explanation of how to implement this, you can find out how someone else managed to implement code coverage in Ruby on Rails. You can see here to use jestwith the flag --coverageto get coverage results.
I think it would be wise to share the coverage of JavaScript code with your other functional tests, as each tutorial there seems to be inclined to separate them.
Here's another tutorial in case the other isn’t exactly what you are looking for: https://reactjsnews.com/setting-up-rails-for-react-and-jest
source
share