PlayCanvas scripts testing ideas

It’s a bit of tough one.

What I would consider is to use a presenter pattern where your PlayCanvas script types are effectively proxies for the logic class

And that way, you can more easily have automated tests for these without involving PlayCanvas at all or mocking the script type interface

I did try some Unit Testing in PlayCanvas using qunit here Automatic code testing in the online editor?

Although Jest is the industry standard, I believe you would have to run this locally on node or something similar. If Jest is needed, you could have a job/script that could use playcanvas-sync to get all the script files and run Jest against your test folder? Not perfect but would allow you to continue writing code and tests in the Editor

1 Like