wallabyjs / public

Repository for Wallaby.js questions and issues
http://wallabyjs.com
757 stars 45 forks source link

Electron apps testing support #943

Open ArtemGovorov opened 7 years ago

ArtemGovorov commented 7 years ago

Wallaby already supports Electron as a test runner for browser apps, what we do there is running browser tests in the renderer process.

If your Electron app tests are only using renderer process, then using this setting should be enough and wallaby should work for you.

Would be awesome to add Electron applications testing (with the main process access) support.

mceachen commented 7 years ago

Thanks for opening this! If you haven't looked at it before, electron-mocha spawns electron with an app that runs mocha.

kwonoj commented 7 years ago

This'll be super awesome support, can't wait for it!

aledoroshenko commented 7 years ago

Don't see a better place to ask - should node modules work in Electron app? I've added Wallaby to existing Electron project with Webpack and Babel, but have errors about node modules like Module not found: Error: Can't resolve 'child_process' or Module not found: Error: Can't resolve 'fs'. I have kind: 'electron' in my config, what else should i check?

ArtemGovorov commented 7 years ago

@aledoroshenko It depends. If you're trying to test an Electron app with the access to the main process, then it won't work, because wallaby doesn't support it yet and this feature request is exactly about it.

However, if your tests are only using the renderrer process, then you may enable node in the renderrer process:

env: {
      kind: 'electron',
      options: {
        webPreferences: {
          nodeIntegration: true
        }
      }
    },

Note that you may also need to add globalPaths for Electron, like discussed here.

waistcoat1971 commented 6 years ago

Any news on supporting running tests in the main electron process?