UNPKG

electron-spawn

Version:

easy way to run code inside of a headless electron window from the CLI

22 lines (20 loc) 652 B
if (process.versions['electron']) { module.exports = function (scripts) { console.log('test success: ' + scripts.join(',')) require('electron').remote.app.quit() } } else { var test = require('tape') var electronSpawn = require('./index.js') test('can spawn electron through an API', function (t) { t.plan(1) var electron = electronSpawn('test.js') electron.stdout.on('data', function (data) { data = data.toString() if (data.indexOf('test success') !== -1) { t.ok(data.indexOf('test success: test.js') !== -1, 'found the text we had our electron script output') t.end() } }) }) }