Developer tools are only used if they work. We have built APIs to test plugins.
Flipper uses Jest as unit testing framework.
Writing unit tests for Flipper Desktop plugins is covered in detail in the tutorial.
flipper-plugin package provide several test utilities to make testing more convenient.
There are two mock classes that are used to construct tests
FlipperResponderMock. Together these can be used to write very powerful tests to verify the end to end behavior of your plugin. For example we can test if for a given incoming message our plugin responds as we expect.
Start by creating your first test file in this directory
MyFlipperPluginTests.cpp and import the testing utilities from
fbsource//xplat/sonar/xplat:FlipperTestLib. These utilities mock out core pieces of the communication channel so that you can test your plugin in isolation.
Here is a simple test using these mock utilities to create a plugin, send some data, and assert that the result is as expected.
Running (Flipper) tests
yarn jest or
yarn jest --watch in the
desktop directory of your Flipper checkout.
In the root directory of the checkout:
See testing React Native.