-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Description
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 mock electron 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 the electron executable here in the vite-node runtime, since my understanding is the electron exec is just a wrapper around node with electron modules injected. It seems like there has been a lot of work put into vite-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
- Follow our Code of Conduct
- Read the Contributing Guidelines.
- Read the docs.
- Check that there isn't already an issue that request the same feature to avoid creating a duplicate.