Efficiently unit testing plugins (using Talk testsuite)


We’d like to efficiently unit test our custom plugins, so I was wondering: Is there a way to use the testsuite in Coral Talk to run testcases for specific plugins.

It seems quite complex to test plugin code without the Talk codebase being there, as the plugin obviously uses Talk’s plugin API. And setting up a per-plugin testsuite would probably contain a lot of duplicate code from Talk’s testsuite.

I was thinking along the lines of:

  • Build Talk with the custom plugins that need testing.
  • Configure those plugins as needed for running tests.
  • Run tests as needed, e.g.
    • yarn test_plugin:server my-plugin
    • yarn test_plugin:client my-plugin

Which effectively runs plugin-specific tests similar to Talk’s:

  • tests/server/routes/api/assets/index.js
  • tests/e2e/specs/03_embedStream.js

Tests would then be located in <talk_root>/plugins/my-plugin/tests/*.

Is there already a way to accomplish the above?

Does anybody have an example on how to test custom plugins?

I’d be glad to open an issue on Github for the above.


Hey @TBeijen, yes please open this on Github, so we can discuss this in the dev community!