twolfson / karma-electron

Karma launcher and preprocessor for Electron
The Unlicense
59 stars 21 forks source link

`electron` did show not nothing happen then #33

Closed githoniel closed 6 years ago

githoniel commented 6 years ago

I use config below

module.exports = config => {
  config.set({
    browsers: ['visibleElectron'],
    client: {
      useIframe: false
    },
    coverageReporter: {
      dir: './coverage',
      reporters: [
        { type: 'lcov', subdir: '.' },
        { type: 'text-summary' }
      ]
    },
    customLaunchers: {
      'visibleElectron': {
        base: 'Electron',
        flags: ['--show']
      }
    },
    frameworks: ['mocha', 'chai'],
    files: ['./index.js'],
    preprocessors: {
      './index.js': ['webpack', 'sourcemap']
    },
    reporters: ['spec', 'coverage'],
    singleRun: true,
    webpack: webpackConfig,
    webpackMiddleware: {
      noInfo: true
    }
  })
}

when I run karma, electron come out with white screen and no error in electron console.

13 10 2018 08:49:27.981:INFO [karma]: Karma v2.0.5 server started at http://0.0.0.0:9876/
13 10 2018 08:49:27.983:INFO [launcher]: Launching browser visibleElectron with unlimited concurrency
13 10 2018 08:49:28.044:INFO [launcher]: Starting browser Electron
13 10 2018 08:50:28.051:WARN [launcher]: Electron have not captured in 60000 ms, killing.
13 10 2018 08:50:28.097:INFO [launcher]: Trying to start Electron again (1/2).
13 10 2018 08:51:28.098:WARN [launcher]: Electron have not captured in 60000 ms, killing.
13 10 2018 08:51:28.138:INFO [launcher]: Trying to start Electron again (2/2).
13 10 2018 08:52:28.146:WARN [launcher]: Electron have not captured in 60000 ms, killing.
13 10 2018 08:52:28.188:ERROR [launcher]: Electron failed 2 times (timeout). Giving up.

tried reinstall node_modules but do not help

  "karma": "^2.0.2",
  "karma-chai": "^0.1.0",
  "karma-coverage": "^1.1.2",
  "karma-electron": "^6.0.0",
  "karma-mocha": "^1.3.0",
  "karma-sourcemap-loader": "^0.3.7",
  "karma-spec-reporter": "^0.0.32",
  "karma-webpack": "^3.0.0",
githoniel commented 6 years ago

https://github.com/karma-runner/karma/issues/1206#issuecomment-332377273

this helped!

13 10 2018 09:02:13.154:INFO [karma]: Karma v2.0.5 server started at http://0.0.0.0:9876/
13 10 2018 09:04:13.322:ERROR [launcher]: 
C:\git\mainApp\node_modules\electron\dist\electron.exe C:\git\mainApp\node_modules\karma-electron\lib/electron-launcher.js --show --user-data-dir C:\Users\user\AppData\Local\Temp\karma-69610976 --url http://localhost:9876/?id=69610976

use chrome to open http://0.0.0.0:9876/ is OK, but http://localhost:9876 is blocked by my VPN.