How can I get JavaScript coverage for nyc / istanbul from rspec integration tests

I have a Ruby on Rails app with a JavaScript interface (mostly React). The set of function tests rspecperforms a significant part of the JavaScript interface code, but I do not see any visibility in this. Meanwhile, JavaScript module tests — through jest— provide JavaScript coverage mapping.

I would like to get cumulative JavaScript coverage results from tag-based integration tags rspec, but I have not found examples of this. nycThe standard JS coverage library should be able to do this - perhaps in conjunction with babel-plugin-istanbul.

+4
source share
1 answer

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

+2
source

Source: https://habr.com/ru/post/1692947/


All Articles