Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/pfrazee/electron-tape
Tape testing harness for electron apps
https://github.com/pfrazee/electron-tape
Last synced: about 2 months ago
JSON representation
Tape testing harness for electron apps
- Host: GitHub
- URL: https://github.com/pfrazee/electron-tape
- Owner: pfrazee
- Created: 2015-08-15T21:49:46.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2015-08-15T22:02:16.000Z (over 9 years ago)
- Last Synced: 2024-10-17T17:36:51.671Z (2 months ago)
- Language: JavaScript
- Size: 113 KB
- Stars: 5
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Electron Tape
A [tape](npm.im/tape) testing harness for electron apps.
## Usage
To use electron-tape, you create two test files: one for the main thread, and one for the ui thread.
Both files will be loaded and run simultaneously. The test results will be output in the logs of their respective threads. Both threads will remain open so you can check the results.
To run the tests, call `electron --v=-1 `.
**main-test.js:**
```js
var etape = require('electron-tape')
var ipc = require('ipc')etape(__dirname+'/ui-test.js', function (tape, window) {
tape('send/receive data', function (t) {
// send 1, 2, 3
window.webContents.send('test-channel', 1)
window.webContents.send('test-channel', 2)
window.webContents.send('test-channel', 3)// receive 1, 2, 3
var n = 0
ipc.on('test-channel', function (e, v) {
t.equal(v, ++n)
if (n === 3)
t.end()
})
})})
```**ui-test.js:**
```js
var etape = require('electron-tape')
var ipc = require('ipc')etape(function (tape) {
tape('send/receive data', function (t) {
// send 1, 2, 3
ipc.send('test-channel', 1)
ipc.send('test-channel', 2)
ipc.send('test-channel', 3)// receive 1, 2, 3
var n = 0
ipc.on('test-channel', function (e, v) {
t.equal(v, ++n)
if (n === 3)
t.end()
})
})})
```