electron-mock-factory
SkillDev toolsGenerate mocks for Electron APIs (ipcMain, ipcRenderer, dialog, etc.) for unit testing
Use electron-mock-factory in Claude, ChatGPT or Ahel Desktop
Free. Sign in, add electron-mock-factory and connect your AI. About a minute.
Also: Claude Code · Cursor · Codex
Then ask your AI: use the electron-mock-factory skill
Details
Instructions available. Your AI can read the instructions. Execution depends on the setup they require.
Account requirements not reviewed. Check the skill instructions before use; Ahel provides instructions and does not run this skill.
No other account needed.
Add Ahel to your AI once: Claude, ChatGPT, Cursor, Claude Code or Codex. Then ask it to use this.
What this skill tells your AI
The instructions your AI receives, as published by a5c-ai/babysitter in library/specializations/desktop-development/skills/electron-mock-factory/SKILL.md and read by Ahel’s review.
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
{
"type": "object",
"properties": {
"projectPath": { "type": "string" },
"testFramework": { "enum": ["jest", "vitest", "mocha"] },
"modulesToMock": { "type": "array" }
},
"required": ["projectPath"]
}
Generated Mocks
// __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
jest.mock('electron');
const { ipcRenderer } = require('electron');
test('sends message', () => {
myModule.sendMessage('hello');
expect(ipcRenderer.send).toHaveBeenCalledWith('channel', 'hello');
});
Related Skills
playwright-electron-configdesktop-unit-testingprocess
Signals
- GitHub stars
- 2k
- Forks
- 113
- Last commit
- Sep 2026
Advanced
- Item type
- skill
- Key
electron-mock-factory- Source
- github.com/a5c-ai/babysitter
Related picks
Skill · thedaviddias
The pick for JavaScriptmodern-javascript-patterns
Skill · wshobson
The pick for JavaScriptsetup-ts-deep-modules
Skill · mattpocock
The pick for TypeScripttypescript-pro
Skill · jeffallan
The pick for TypeScriptteach
Skill · mattpocock
More in Dev toolscaveman
Skill · juliusbrussee
More in Dev tools