faux-jax
faux-jax copied to clipboard
issue with cached XMLHttpRequest
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');
Thanks, careful about the current workaround, the library will then always use faux-jax fake implementation.
maybe restore
should make the fake XMLHttpRequest a proxy.
That's a good idea @bloodyowl, we could do it