You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It'd be nice to have new unit tests for q5, especially for its exclusive functions. This is something I'd like to delegate to the community though. Let me know if you're interested!
The main benefit of unit tests is providing a quick way to ensure that a software library is functioning correctly after making updates to it.
I was able to fork the test folder from p5.js and ran them with q5.js.
I liked the idea that these were browser based mocha tests, however since they run asynchronously I found that debugging them is a nightmare. That's pretty bad, since the whole point of unit tests is to make debugging easier. Also the quality of the tests is quite mixed, several of them reference internal private variables (don't do that!) which makes them useless for our purposes. The visual webgl tests seem great, but of course q5 doesn't have webgl mode.
This still proved to be a valuable exercise though, since I did find and fix 4 bugs in q5. Yet, I'm not going to include p5's tests in the q5 repo as I had originally planned. Download this, put it in the q5 folder, and open p5-tests/test.html in a live server to see the results: p5-tests.zip
q5 unit testing
q5-server.js enables q5 to run with node.js, bun, or deno.
An example test can be found in tests/core.test.js
It'd be nice to have new unit tests for q5, especially for its exclusive functions. This is something I'd like to delegate to the community though. Let me know if you're interested!
The main benefit of unit tests is providing a quick way to ensure that a software library is functioning correctly after making updates to it.
See p5's page on unit testing: https://p5js.org/contribute/unit_testing/
Why not use p5's unit tests?
I was able to fork the
test
folder from p5.js and ran them with q5.js.I liked the idea that these were browser based mocha tests, however since they run asynchronously I found that debugging them is a nightmare. That's pretty bad, since the whole point of unit tests is to make debugging easier. Also the quality of the tests is quite mixed, several of them reference internal private variables (don't do that!) which makes them useless for our purposes. The visual webgl tests seem great, but of course q5 doesn't have webgl mode.
This still proved to be a valuable exercise though, since I did find and fix 4 bugs in q5. Yet, I'm not going to include p5's tests in the q5 repo as I had originally planned. Download this, put it in the q5 folder, and open p5-tests/test.html in a live server to see the results: p5-tests.zip
q5 unit testing
q5-server.js
enables q5 to run with node.js, bun, or deno.An example test can be found in
tests/core.test.js
https://bun.sh/docs/cli/test
https://jestjs.io/docs/expect
The text was updated successfully, but these errors were encountered: