Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing error handler on socket when I get "Delaying execution, these browsers are not ready: Chrome" from previous test #2526

Open
kamok opened this issue Jan 4, 2017 · 3 comments

Comments

@kamok
Copy link

kamok commented Jan 4, 2017

Expected behaviour

I expect Karma not to crash when it runs the test again after displaying "Delaying execution, these browsers are not ready: Chrome" from the previous test.

Actual behaviour

This happens when I make some changes and then save my file. Before karma finishes running, if I do another save after a change, it will first interrupt the test with 04 01 2017 15:00:37.775:INFO [karma]: Delaying execution, these browsers are not ready: Chrome 55.0.2883 (Mac OS X 10.11.6).

Then, it will finish the rest of the expectations (they are all green), and then display

=========================================================================================================================

START:

Finished in 0 secs / 0 secs

before running the test again, because of that second save that I did. Then it will run through all my tests again (all green), and then give this error with the missing error handler on socket:

Missing error handler on `socket`.
TypeError: Cannot read property 'set' of null
    at KarmaRemapIstanbul.onBrowserComplete (/Users/kamok/code/election/election-mobile/node_modules/karma-remap-istanbul/index.js:28:16)
    at Server.<anonymous> (/Users/kamok/code/election/election-mobile/node_modules/karma/lib/events.js:13:22)
    at emitTwo (events.js:111:20)
    at Server.emit (events.js:191:7)
    at Browser.onComplete (/Users/kamok/code/election/election-mobile/node_modules/karma/lib/browser.js:143:13)
    at Socket.<anonymous> (/Users/kamok/code/election/election-mobile/node_modules/karma/lib/events.js:13:22)
    at emitTwo (events.js:111:20)
    at Socket.emit (events.js:191:7)
    at Socket.onevent (/Users/kamok/code/election/election-mobile/node_modules/karma/node_modules/socket.io/lib/socket.js:335:8)
    at Socket.onpacket (/Users/kamok/code/election/election-mobile/node_modules/karma/node_modules/socket.io/lib/socket.js:295:12)
    at Client.ondecoded (/Users/kamok/code/election/election-mobile/node_modules/karma/node_modules/socket.io/lib/client.js:193:14)
    at Decoder.Emitter.emit (/Users/kamok/code/election/election-mobile/node_modules/component-emitter/index.js:134:20)
    at Decoder.add (/Users/kamok/code/election/election-mobile/node_modules/socket.io-parser/index.js:247:12)
    at Client.ondata (/Users/kamok/code/election/election-mobile/node_modules/karma/node_modules/socket.io/lib/client.js:175:18)
    at emitOne (events.js:96:13)
    at Socket.emit (events.js:188:7)
    at Socket.onPacket (/Users/kamok/code/election/election-mobile/node_modules/karma/node_modules/engine.io/lib/socket.js:101:14)
    at emitOne (events.js:96:13)
    at WebSocket.emit (events.js:188:7)
    at WebSocket.Transport.onPacket (/Users/kamok/code/election/election-mobile/node_modules/karma/node_modules/engine.io/lib/transport.js:104:8)
    at WebSocket.Transport.onData (/Users/kamok/code/election/election-mobile/node_modules/karma/node_modules/engine.io/lib/transport.js:115:8)
    at WebSocket.onData (/Users/kamok/code/election/election-mobile/node_modules/karma/node_modules/engine.io/lib/transports/websocket.js:76:30)
    at emitTwo (events.js:106:13)
    at WebSocket.emit (events.js:191:7)
    at Receiver.ontext (/Users/kamok/code/election/election-mobile/node_modules/karma/node_modules/ws/lib/WebSocket.js:816:10)
    at /Users/kamok/code/election/election-mobile/node_modules/karma/node_modules/ws/lib/Receiver.js:477:18
    at /Users/kamok/code/election/election-mobile/node_modules/karma/node_modules/ws/lib/Receiver.js:361:7
    at /Users/kamok/code/election/election-mobile/node_modules/karma/node_modules/ws/lib/PerMessageDeflate.js:247:5
    at afterWrite (_stream_writable.js:387:3)
    at onwrite (_stream_writable.js:378:7)
    at WritableState.onwrite (_stream_writable.js:89:5)
    at afterTransform (_stream_transform.js:79:3)
    at TransformState.afterTransform (_stream_transform.js:54:12)
    at Zlib.callback (zlib.js:639:5)
04 01 2017 15:00:48.724:WARN [Chrome 55.0.2883 (Mac OS X 10.11.6)]: Disconnected (1 times)
Chrome 55.0.2883 (Mac OS X 10.11.6) ERROR
  Disconnectedundefined
Chrome 55.0.2883 (Mac OS X 10.11.6) ERROR
  Disconnectedundefined

Environment Details

  • Karma version (output of karma --version):
    Karma version: 1.3.0
  • Relevant part of your karma.config.js file
basePath: '',
    frameworks: [
      'jasmine',
      'angular-cli',
      'jasmine-matchers' // https://github.com/JamieMason/karma-jasmine-matchers
    ],
    plugins: [
      require('karma-phantomjs-launcher'),
      require('karma-jasmine'),
      require('karma-chrome-launcher'),
      require('karma-remap-istanbul'),
      require('karma-mocha-reporter'),
      require('angular-cli/plugins/karma'),
      require('karma-jasmine-matchers') // https://github.com/JamieMason/karma-jasmine-matchers
    ],
    files: [   // http://karma-runner.github.io/1.0/config/files.html
      { pattern: './src/test.ts', watched: false },
      { pattern: './www/assets/images/*.jpg', watched: false, included: false, served: true},
      { pattern: './www/json/*.json', watched: false, included: false, served: true}
    ],
    preprocessors: {
      './src/test.ts': ['angular-cli']
    },
    remapIstanbulReporter: {
      reports: {
        html: 'coverage',
        lcovonly: './coverage/coverage.lcov'
      }
    },
    proxies:  {
      '/assets/': '/base/www/assets/',
      '/json/': '/base/www/json/',
    },
    angularCli: {
      config: './angular-cli.json',
      environment: 'dev'
    },
    reporters: [
      'mocha', 'karma-remap-istanbul'
    ],
    port: 9876,
    colors: true,
    logLevel: config.LOG_INFO,
    autoWatch: true,
    browsers: ['Chrome'], // 'PhantomJS' or 'Chrome'
    singleRun: false,
    mime: { 'text/x-typescript': ['ts', 'tsx'] }

Steps to reproduce the behaviour

See above. This is only is Chrome. On PhantomJS it works fine. Basically Karma shutsdown if I save again before the first test is finished running.

@kamok
Copy link
Author

kamok commented Jan 4, 2017

I'm aware of #2042, but I think it's a different problem.

@wesleycho
Copy link
Member

This looks like a quick workaround probably can be made here to fix this.

Ultimately this seems like a race condition where onBrowserComplete isn't being executed on the reporters before executing the next test suite execution.

@abogartz
Copy link

I've also been having this problem for about the last month.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants