Benefits of having big tech companies

Just a thought. Was looking for ways to run unit tests for Electron code. Not e2e ones (e.g. assert window.webContents.getElementByXXX), but only unit tests. But the code is inevitably tangled with Electron API, like ipcRenderer, which will not be available when running using node.

When required from node, require('electron') returns the path to platform-specific binary location.

Test frameworks use runners to run tests - many of them adopted the idea of “plugin framework”. Jest, mocha… they all accepts custom runner, custom testRunner and custom testEnv. Problem is where to find the proper runner (or write one yourself, which may or may not be feasible).

After several non-working solutions https://github.com/wallabyjs/public/issues/1567 https://github.com/facebook/jest/issues/3698 https://stackoverflow.com/questions/44164862/run-jest-with-electron-instead-of-node https://github.com/d4rkr00t/jest-electron-runner#readme (tests never end), finally there’s this: https://github.com/facebook-atom/jest-electron-runner

So that’s the benefit of having bigger tech companies in the industry. Someone would have done work that you don’t have time to, for you.

Written on December 12, 2018