Access Electron APIs inside unit tests


#1

I am currently using the latest Electron (1.6+), and have created a package that utilizes some Electron APIs. Specifically it uses app to register a “ready” event, and protocol to register a couple custom protocols. I would like to be able to unit test the module without having to create full functional tests to catch all the edge cases.

However, since I am running my tests in a non electron process, my module does not have access to these APIs. I am using mocha / chai for the basic tests. I have tried various ways of creating functional tests with Spectron, but these did not help.

The package in question is electron-view-renderer (https://www.npmjs.com/package/electron-view-renderer) in case someone has an idea but needs to see the details.

Any help is much appreciated, thank you.