Browser Mode: Electron support #5883
Labels
feat: browser
Issues and PRs related to the browser runner
p2-nice-to-have
Not breaking anything but nice to have (priority)
Clear and concise description of the problem
It would be great to have an Electron mode for browser mode so that Electron apps could be tested easily. Currently, to test code that needs to import
electron
(provided by the electron runtime here, I believe), my understanding is it's necessary to either mockelectron
or set up full E2E testing manually, outside of vitest.I may be able to make a PR for this, with some guidance.
Suggested solution
Webdriverio and Playwright seem to have some kind of Electron support:
However I'm not sure if those play nicely with the model of browser mode.
Alternative
An alternative which would be very useful: to just allow testing the main Electron process code (not testing the renderer or preload code). It may be as easy as allowing to swap
node:vm
for theelectron
executable here in the vite-node runtime, since my understanding is theelectron
exec is just a wrapper around node withelectron
modules injected. It seems like there has been a lot of work put intovite-node
, so it would be nice to reuse that instead of making an entirely new runner.Additional context
Electron was mentioned in #1470 in the context of custom test runners, but I'm not sure if any work specific to electron was done.
This repo could be useful for making a new runner or modifying the existing: https://github.com/kayahr/jest-electron-runner
Validations
The text was updated successfully, but these errors were encountered: