How do I achieve 80% coverage when using a Frontend framework like React?

I use React to build user interfaces for a Marketplace app that needs to be submitted to the Marketplace gallery.

Despite covering all the app’s code paths, the coverage stands at 56%.

On further investigation I noticed that it is caused due to the vendor file generated by React.
This file contains all the framework logic of React. It has code paths that may never be traversed by my app’s logic.

How can I achieve the coverage goals in such a scenario?

Hey @arunrajkumar235,

Fdk by default runs coverage for the js files inside /app folder, but in terms of an app built using frameworks like react or vue the coverage should be run against the component source code(mostly /src folder)

Since FDK doesn’t support this natively, you can overcome it by writing jest unit tests for the react components and run jest test --coverage for the app, and share it with the reviewer separately or add steps to run the tests in the notes for the reviewer.

Hope this helps!

Stay Safe :slight_smile:

1 Like


But, the app gets rejected automatically within a minute of submitting it when the coverage is less than 80%.
It doesn’t even reach the stage of the code review.

1 Like


That’s right, but despite the rejection, a new ticket will be created in the app review portal, you can just reply with your reason and suggest the alternative code coverage mechanism to the reviewer.