Skip to content

jsantell/electron-ipc-mock

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

electron-ipc-mock

Build Status Build Status

Mock Communication for Electron's IPC

An API mimicking Electron's ipcMain and ipcRenderer. Swap out electron calls in your code in tests to access both mock renderer and main process IPC communication calls.

Install

npm install electron-ipc-mock

Usage

const { ipcRenderer, ipcMain } = require('electron-ipc-mock')();

ipcMain.on('request', function (e, ...args) {
  console.log(args[0]); // 'hello'
  e.sender.send('response', 'world');
});

ipcRenderer.on('response', function (e, ...args) {
  console.log(args[0]); // 'world'
});

ipcRenderer.send('request', 'hello')

Testing

npm test

License

MIT License, Copyright (c) 2016 Jordan Santell

About

Mock channels for Electron's IPC communication

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published