pusher-community / pusher-js-test-stub

The Pusher Test Stub provide a way of testing your client-side integration with the Pusher JavaScript library and lets you trigger events to ensure that your application behaves in the way you expect it to.
http://blog.pusher.com/2011/9/2/testing-your-integration-with-the-pusher-javascript-library
28 stars 9 forks source link

npm support #19

Open yarcub opened 8 years ago

yarcub commented 8 years ago

Hi, have you considered making this package also available on npm?

jackfranklin commented 8 years ago

@yarcub we haven't but that would be something we probably should do. I'll have a look into it soon.

jackfranklin commented 8 years ago

So I just looked into this but it would take a bit more work to make this work properly in a CommonJS environment.

It works in the browser by replacing window.Pusher with the stubbed version, but in a CommonJS environment you wouldn't be able to do this. We'd love to look into this further; please let us know if you have any further thoughts.

farisj commented 7 years ago

Hello! I know this issue is old but I'd like to suggest an idea.

Perhaps we can export the PusherTestStub object itself so that users could manually bind that object to window.Pusher?

A user-facing example (in my Ember app testing with QUnit) would look like:

//test-helper.js
import PusherTestStub from 'pusher-test-stub';

export default {
    beforeEach: function(){
        ...
        window.Pusher = PusherTestStub;
        ...
    }
}

Would this be feasible? Thanks!

nikolalsvk commented 6 years ago

Hey y'all 👋

I released an NPM library for mocking Pusher in your tests. If you're interested, check it out at https://github.com/nikolalsvk/pusher-js-mock