Closed yuripourre closed 1 year ago
Oh, I have a plan to create a visualization test suite for babylon.js projects. I can add it here as well :-)
Might take a while (as always), but this is a wonderful addition.
@RaananW looking forward to it! No rush, if I find a cleaner way to add tests meanwhile, I can open a PR.
What about jest type testing in the browser? Can we do that too?
@RaananW grateful for you! I was hanging by my last neuron, until I found this repo. Now, life is bliss, lol.
running npm run test
will now launch playwright validation tests in chrome for the scenes.
Note that if you want the validation tests to be deterministic, make sure you add some event or an observable you can hook into to decide when to take the screenshot.
I'm not familiar w/ playright, does jest-like tests too?
Sorry, submitted too early :-)
It is an in-browser testing framework. It's not jest, but has a very similar API.
I think unit-testing for a babylon scene is a little less needed. If it is I can add jest configuration - but I don't see any proper unit test I can add to this repo
I would be grateful for jest. I'm working on procedural generation tooling, which is nothing but vector math. Having both would be awesome.
@RaananW I don't want you to have more work but I second @unicomp21. I rely on jest tests a lot, I could port my changes to this repo but I changed my fork too much.
All you need is a proper jest configuration if you want to run unit tests in this repo. I'd be more than happy to suggest, however, from experience, a 3D experience is better tested using visual tests and not unit tests.
I'll add the config very soon
@RaananW at a high level, agree 100%. But for automated testing of primitives, ie something like Vector3.cross(), jest tests makes sense at this level, right? The stuff I'm working on involves primitives, which don't yet exist in babylon.js
A working jest config was added, able to load esm, typescript, and babylon.
Many thanks @RaananW, appreciate you!
Thank you @RaananW !!
This repo saved me a lot of time setting a new project, thank you so much for your efforts.
I think the only step missing to have the perfect template repo is the test structure.
I added tests to my private fork but it doesn't look very good, maybe someone with more experience with typescript would be able to come with a proper solution.