run_electron_app: Run Electron Application for Testing

View source: R/run.R

run_electron_appR Documentation

Run Electron Application for Testing

Description

Launches a previously exported Electron application for testing and debugging without building distributable packages. Pass the electron-app directory from a prior export() call.

Usage

run_electron_app(
  app_dir,
  port = 3000,
  open_devtools = TRUE,
  verbose = TRUE,
  update_version = NULL
)

Arguments

app_dir

Character string. Path to the Electron application directory (the electron-app subdirectory from export()).

port

Integer. Port number for the development server. Default is 3000.

open_devtools

Logical. Whether to open Chromium DevTools automatically. Default is TRUE.

verbose

Logical. Whether to display detailed progress information. Default is TRUE.

update_version

Character string or NULL. A version such as "2.0.0" runs the app against a local update feed offering that version, so the update check can be tried without publishing a release. The app must have been exported with auto-updates on (see enable_auto_updates()) by this version of shinyelectron. Download is expected to fail, because the feed holds no installer. On macOS only the startup notice shows the result, so the app must check on startup (check_on_startup, the default), since Help > About has no Check for Updates there. Default is NULL, a normal run.

Value

Invisibly returns the completed processx::run() result list (with status, stdout, and stderr) after Electron exits, or NULL if the run is interrupted. Note that this call blocks until the Electron window is closed.

Details

This function starts the Electron application for testing, which:

  • Opens the application in an Electron window

  • Optionally opens Chromium DevTools for debugging

  • Does NOT build distributable packages (use export(build = TRUE) for that)

  • With update_version, serves a local update feed on ⁠127.0.0.1⁠ and writes dev-app-update.yml into app_dir for the run, then stops the feed and removes the file when the run ends, even after an error or Ctrl+C

Examples


# Run a previously exported Electron app in development mode
run_electron_app("path/to/electron/app")

# Run with custom port and no dev tools
run_electron_app(
  app_dir = "path/to/app",
  port = 8080,
  open_devtools = FALSE
)

# Try the update check against a local feed offering version 2.0.0
run_electron_app("path/to/electron/app", update_version = "2.0.0")


shinyelectron documentation built on Dec. 3, 2026, 9:07 a.m.