Create WebGLRenderer element in test using Mocha

Hi.
I am quite new to Three.js and Java Script, and need some help regarding testing.
I am using Three.js is an Electron app, but wish to test code separately, probably using a web browser.
My code under test takes in a WebGLRenderer-element, and I have issues creating this renderer.

I am currently using Mocha as test framework. I believe I get stuck on how to open a browser window in the beginning of my test, to access a canvas and be able to create a WebGLRenderer.

Can someone please help me out?

Hi, I have currently the same issue, while testing some Three js objects with Chai test and mocha. The unit tests doesnt seems to be able to create webglcontext :

Error: Error creating WebGL context.

renderer = new WebGLRenderer(rendererOptions);