How can I test Theia Extension?

Hello, everyone

I’m trying to write unit tests for Theia Extension.

I have followed through the documentation on Authoring Extension and created a boilerplate template here:

This is basicly just a hello world project from yo generator with a test code copied over from Writing a Test page

There is also a jsdom setup

Yo generator is really nice but it would be alot nicer if it had some basic setup for testing in it. I can create a pull request to add it to yo generator if I can find a way to test plugins.

I would like to be able to test my Theia Extension but I’m stuck with the error below. I’m assuming that I need a working Theia application running to run my tests against but I couldn’t figure out how to go about it.

I have already checked the example directory on Theia repository and read the tests in that folder. I have also checked gitpod Theia editor. I would like to ask your opinions or help.

Error: The configuration is not set. Did you call FrontendApplicationConfigProvider#set?
error Command failed with exit code 1.

I believe you just created an Extension rather than a Plugin. Did you find the Testing doc for extensions?

Thank you for your reply. I have edited the post. Yes, I meant extension instead of plugin and yes I have read through the docs section.

As far as I understand theiaext mentioned on the docs is not publicly available outside the Theia repo. I’m running the yarn test command which is basicly mocha 'src/**/*.spec.js'

I have also tried the commands on the docs but still no result.

@ozbeksu thank you for the discussion, I believe the generator does not add the unit-test framework as to not impose a certain technology or library. I can however create an issue regarding it for discussion.

In the meantime, I create a small example repo (hello-world) which includes unit-tests (with mocha and chai) as an example: