Skip to content

Browser Mode: Electron support #5883

@rynoV

Description

@rynoV

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    feat: browserIssues and PRs related to the browser runnerp2-nice-to-haveNot breaking anything but nice to have (priority)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions