문제

Working on a javascript module that pushes data to a cross domain server. I have a testsuite in qunit verifying the behavior, using sinon for intercepting requests and faking responses coming from XmlHttpRequest. This works great, except for IE8/9 which uses XDomainRequest to allow CORS calls (with a somewhat limited functionality).

My issue is that sinon allows for mocking of my use of XmlHttpRequest but not XDomainRequest. After googling I have not been able to find anyone mocking the XDomainRequest. Does anyone have any practical experience with testing around XDomainRequest and what can be done?

도움이 되었습니까?

해결책

Since sinon at the moment does not support mocking the XDomainRequest I've created a small pullrequest that adds simple mocking support to sinon. Note that the pullrequest is not accepted since it is pretty rough but it worked for me.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top