acvetkov / sinon-chrome

Testing chrome extensions with Node.js
ISC License
435 stars 46 forks source link

How to test event listeners on the port object? #34

Closed cauboy closed 7 years ago

cauboy commented 7 years ago

Hey, thanks a lot for this repo. It really helps. One question: Is there actually a way to test event listeners on the port object. How would one test the following code?

Chrome.runtime.onConnect.addListener(function(port) {
  port.onDisconnect(function() { console.log('Port disconnected'); });
});

Cheers. Clemens

acvetkov commented 7 years ago

@cauboy, hi!

Unfortunately, we does not support port objects. Feel free to create pull request.

cauboy commented 7 years ago

Thought so, just wanted to be sure :)