electron-mock-factory
Generate mocks for Electron APIs (ipcMain, ipcRenderer, dialog, etc.) for unit testing
Best use case
electron-mock-factory is best used when you need a repeatable AI agent workflow instead of a one-off prompt.
Generate mocks for Electron APIs (ipcMain, ipcRenderer, dialog, etc.) for unit testing
Teams using electron-mock-factory should expect a more consistent output, faster repeated execution, less prompt rewriting.
When to use this skill
- You want a reusable workflow that can be run more than once with consistent structure.
When not to use this skill
- You only need a quick one-off answer and do not need a reusable workflow.
- You cannot install or maintain the underlying files, dependencies, or repository context.
Installation
Claude Code / Cursor / Codex
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/electron-mock-factory/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How electron-mock-factory Compares
| Feature / Agent | electron-mock-factory | Standard Approach |
|---|---|---|
| Platform Support | Not specified | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | Unknown | N/A |
Frequently Asked Questions
What does this skill do?
Generate mocks for Electron APIs (ipcMain, ipcRenderer, dialog, etc.) for unit testing
Where can I find the source code?
You can find the source code on GitHub using the link provided at the top of the page.
SKILL.md Source
# electron-mock-factory
Generate mocks for Electron APIs to enable unit testing of main and renderer process code without running Electron.
## Capabilities
- Mock ipcMain/ipcRenderer
- Mock dialog module
- Mock BrowserWindow
- Mock shell, clipboard, app
- Generate Jest/Vitest mocks
- Create test utilities
## Input Schema
```json
{
"type": "object",
"properties": {
"projectPath": { "type": "string" },
"testFramework": { "enum": ["jest", "vitest", "mocha"] },
"modulesToMock": { "type": "array" }
},
"required": ["projectPath"]
}
```
## Generated Mocks
```javascript
// __mocks__/electron.js
module.exports = {
app: {
getPath: jest.fn(name => `/mock/${name}`),
getVersion: jest.fn(() => '1.0.0'),
quit: jest.fn(),
on: jest.fn()
},
ipcMain: {
on: jest.fn(),
handle: jest.fn(),
removeHandler: jest.fn()
},
ipcRenderer: {
on: jest.fn(),
send: jest.fn(),
invoke: jest.fn()
},
dialog: {
showOpenDialog: jest.fn(() => Promise.resolve({ filePaths: [] })),
showSaveDialog: jest.fn(() => Promise.resolve({ filePath: undefined })),
showMessageBox: jest.fn(() => Promise.resolve({ response: 0 }))
},
BrowserWindow: jest.fn().mockImplementation(() => ({
loadURL: jest.fn(),
on: jest.fn(),
webContents: { send: jest.fn(), on: jest.fn() }
}))
};
```
## Usage
```javascript
jest.mock('electron');
const { ipcRenderer } = require('electron');
test('sends message', () => {
myModule.sendMessage('hello');
expect(ipcRenderer.send).toHaveBeenCalledWith('channel', 'hello');
});
```
## Related Skills
- `playwright-electron-config`
- `desktop-unit-testing` processRelated Skills
mock-spec-extractor
Extracts design specifications from mock images including colors, typography, spacing, and component details
api-mock-server
Generate and run mock API servers from OpenAPI specifications
sdk-mock-generator
Generate mock servers and clients for SDK testing
playwright-electron-config
Configure Playwright for comprehensive Electron application testing including E2E tests, visual regression, accessibility audits, and cross-platform test matrices
electron-tray-menu-builder
Generate system tray and context menu configurations with platform-specific icons, menu templates, and event handling
electron-protocol-handler-setup
Register and handle custom URL protocols (deep linking) across platforms for Electron applications
electron-native-addon-builder
Build and bundle native Node.js addons for Electron with proper ABI compatibility, cross-compilation support, and rebuild automation
electron-memory-profiler
Profile Electron app memory usage, detect leaks, analyze renderer process memory, and optimize memory consumption
electron-main-preload-generator
Generate secure main process and preload script boilerplate with proper context isolation, IPC patterns, and security best practices for Electron applications
electron-ipc-security-audit
Analyze Electron IPC implementations for security vulnerabilities including contextIsolation, nodeIntegration, preload scripts, and channel validation
electron-builder-config
Generate and validate electron-builder configuration for multi-platform desktop builds with code signing, auto-update, and platform-specific packaging
electron-auto-updater-setup
Configure electron-updater with code signing verification, delta updates, staged rollouts, and multiple update channels for Electron applications