To test blocks in your extension, press the New Project button on the home screen and go to the Extensions dialog. It will list all your GitHub projects as available for addition. Select your extension and see what the blocks look like.

The Genius Trick

You can have one browser tab open with that test project, and another one with the extension. When you switch between them, they reload automatically.

Tests

For testing TypeScript APIs you don't need a separate project, and instead can
use the test.ts file in the extension itself. It is only used when you run the extenssion
directly, not when you add it to a project. You can put TypeScript test code in there.

Limitations

The web app will not let you create extensions with C++. This you still need to do from command line, after installing all required compilers or Docker (depending on target). The good news is that very few extensions contain C++ (mostly because TypeScript is easier to write, test, and in most cases sufficient). The main reason seen so far for needing C++ extensions is the lack of floating point support on the micro:bit (this is now fixed with the v1 release).

This guide was first published on Mar 15, 2019. It was last updated on Mar 15, 2019.

This page (Test your Extension) was last updated on May 08, 2021.

Text editor powered by tinymce.