faux-jax icon indicating copy to clipboard operation
faux-jax copied to clipboard

issue with cached XMLHttpRequest

Open revolunet opened this issue 9 years ago • 3 comments

Thanks for this handy tool !

Some libs cache XMLHttpRequest, ex : https://github.com/iriscouch/browser-request/blob/master/index.js#L15

In this case we cannot use the faux-jax .install() and .restore to setup/teardown

A workaround is to install fauxjax prior to requiring the lib :

var fauxJax = require('faux-jax');
fauxJax.install();
var speedTest = require('speedTest');

revolunet avatar Apr 27 '15 08:04 revolunet

Thanks, careful about the current workaround, the library will then always use faux-jax fake implementation.

vvo avatar Apr 27 '15 08:04 vvo

maybe restore should make the fake XMLHttpRequest a proxy.

bloodyowl avatar May 11 '15 07:05 bloodyowl

That's a good idea @bloodyowl, we could do it

vvo avatar May 11 '15 07:05 vvo