Reputation: 2568
Essentially, what I'm asking is, is there a way to write unit tests for my JavaScript files for three.js library?
I have a 3D viewer that houses a camera, renderer, loader, etc... How do I write tests for something like that? Is there something out there that I can read for that? Is it even possible?
Upvotes: 8
Views: 5820
Reputation: 935
I found a way to unit test webgl/threejs in headless way. This does not need any image comparison etc.
https://github.com/AmitTeli/webgl-three-test
Approach taken:
yarn start
)yarn test
)Upvotes: 1
Reputation: 1211
You can either test properties of the expected state or use headless browser like chromium to render expected and actual images. If you search for testing WebGL, you will find examples of the latter
Upvotes: 0