CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/npm-electron-debug

Adds useful debug features to your Electron app

86

1.19x
Overview
Eval results
Files

task.mdevals/scenario-3/

DevTools Control Panel

Build a simple command-line interface that allows developers to programmatically control Chrome DevTools for Electron applications during development. The tool should provide basic commands to toggle, open, and check the DevTools state for browser windows.

Requirements

Your application should implement a simple Node.js module that exposes functions to control DevTools behavior:

  1. Toggle DevTools: Implement functionality to toggle DevTools on and off for a browser window. If DevTools are currently closed, they should open. If they're open, they should close.

  2. Open DevTools: Implement functionality to explicitly open DevTools for a browser window, ensuring they are visible.

  3. DevTools State Check: Provide a way to query whether DevTools are currently open for a given window.

The module should handle the case where no specific window is provided by defaulting to the currently focused browser window.

Test Cases

Your implementation must pass the following test cases:

  • When DevTools are closed, toggling should open them @test
  • When DevTools are open, toggling should close them @test
  • Opening DevTools when they are already open should not cause errors @test
  • DevTools state check correctly returns true when DevTools are open @test

Implementation

@generates

API

/**
 * Toggle DevTools open/closed state for the specified window or focused window
 * @param {BrowserWindow} [window] - The window to toggle DevTools for
 */
function toggleDevTools(window) {}

/**
 * Open DevTools for the specified window or focused window
 * @param {BrowserWindow} [window] - The window to open DevTools for
 */
function openDevTools(window) {}

/**
 * Check if DevTools are currently open for the specified window or focused window
 * @param {BrowserWindow} [window] - The window to check DevTools state for
 * @returns {boolean} True if DevTools are open, false otherwise
 */
function isDevToolsOpen(window) {}

module.exports = {
  toggleDevTools,
  openDevTools,
  isDevToolsOpen,
};

Dependencies { .dependencies }

electron-debug { .dependency }

Provides debug features and DevTools management for Electron applications.

@satisfied-by

Install with Tessl CLI

npx tessl i tessl/npm-electron-debug

tile.json