wallabyjs / atom-wallaby

Wallaby.js atom package starter
Other
57 stars 6 forks source link

Using electron instead of electron-prebuilt #48

Closed tjoskar closed 7 years ago

tjoskar commented 7 years ago

Hi,

I just switch from electron-prebuilt to electron to get rid of some warnings (and for securing the feature: http://electron.atom.io/blog/2016/08/16/npm-install-electron).

However, when I start wallaby in Atom I get the following error:

Failed to load configuration file:  Electron runner path is not specified and `electron-prebuilt` module was not found.
Either specify a path in `env.runner` or install the electron module by running `npm install electron-prebuilt --save-dev`

Fair enough, I update the wallaby.js config file to contain:

env: {
  kind: 'electron',
  runner: 'node_modules/.bin/electron'
}

and try to start wallaby once again, but this time I get the following error:

.atom/packages/atom-wallaby/wallaby-atom/index.js:14
Wallaby Console: .atom/packages/atom-wallaby/wallaby/runners/browser/electronHost.js:14
Wallaby Console: var ipc,electron=require("electron"),currentRequestId=0;if(global.window)ipc=electron.ipcRenderer,ipc.on("message",function(event,msg){eval(msg.code),ipc.send("message",{id:msg.id})});else{process.setFdLimit&&process.setFdLimit(8192),process.on("uncaughtException",function(e){e&&e.message&&host&&host._send({type:"error",error:{message:e.message,stack:e.stack}})});var fs=require("fs"),_=require("lodash");ipc=electron.ipcMain;var app=electron.app,BrowserWindow=electron.BrowserWindow;"darwin"===process.platform&&app.dock.hide();var Host=function(){this._pages=Object.create(null),this._callbacks=Object.create(null)};Host.prototype={stop:function(){app.exit(0)},closePage:function(e){var t=e.pageId;this._destroyExistingPage(t)},evaluateOnPage:function(e,t){var i=e.pageId,n=this._pages[i];this._requestWithCorrelationId(n,{code:e.action},t)},openPage:function(e,t){var i=e.pageId,n=e.url,s=_.defaults(e.options||{},{width:800,height
Wallaby Console: TypeError: process.send is not a function
Wallaby Console:     at Object._send (.atom/packages/atom-wallaby/wallaby/runners/browser/electronHost.js:14:1573)
Wallaby Console:     at process.<anonymous> (.atom/packages/atom-wallaby/wallaby/runners/browser/electronHost.js:14:303)
Wallaby Console:     at emitOne (events.js:101:20)
Wallaby Console:     at process.emit (events.js:188:7)
Wallaby Console:     at process._fatalException (bootstrap_node.js:304:26)

Okay, maybe I should enter the path to package folder, not the bin file. So I update the runner to:

env: {
  kind: 'electron',
  runner: 'node_modules/electron/'
}

But now I get the error:

Wallaby Console: Error: spawn EACCES

According to #28 you recommend to include the path to node so let's do it (even though it works out of the box with electron-prebuilt) so I add the following in my init script:

process.env.WALLABY_NODE = '/usr/local/bin/node';

I exit atom and start atom from the terminal but I still get the same error message:

Wallaby Console: Error: spawn EACCES

BUT if I install electron-prebuilt(npm install electron-prebuilt) and update the env to:

env: {
  kind: 'electron'
}

Everything work like a charm. So my question is how I can use wallaby with electron instead of electron-prebuilt.

Versions: Atom: 1.10.2 node: 6.6.0 electron: 1.4.4 electron-prebuilt: 1.3.8 atom-wallaby: 1.0.11

ArtemGovorov commented 7 years ago

I think there's an issue with the path you're trying to specify to the Electron executable. The electron package actually exports the path, so you may just do:

    env: {
      kind: 'electron',
      runner: require('electron') // <-- will set the correct path
    },

BTW, thanks for raising the issue, we'll switch to look for the electron package instead of the electron-prebuilt package soon.

tjoskar commented 7 years ago

Thanks, it worked 🎉