The tests in this folder are run via gulp karma and will be executed in a browser.
Tests for the Blockly compiler take a .blocks file as input and compare
the output against a baseline .ts file. To generate those files:
- Add the required block definitions in the
test-librarydirectory. Make sure you add the.tsfile you create topxt.json. Note: do not add any C++ files, this library only accepts TypeScript! - Create the
.blocksfile for the test. There is no easy way to do it, but this is the method I follow: a. Copy the code you added in step 1 to some target (likepxt-sample) b. Runpxt servein that target and create your test case in the editor c. Inside theprojectsdirectory of that target, a directory should have been created for the new project you just made in the editor. Grab themain.blocksfile from that directory. - Place the
.blocksfile in thecasessubdirectory. - Add the expected result
.tsfile with the same name (but different file extension) to thebaselinesdirectory - In
test.spec.ts, add a test case for your new files. Copy the other ones in that file and give it a relevant message.