You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Seems like your test isn't properly mocking the global XMLHttpRequest, so you'll need to make sure that's being done correctly. If you can't get it to work, please file a separate issue.
What's the issue?
I am trying to add a tests for a file of mine which uses XHR. In order to do this, I tried setting up a small testfile for my code and mocked the XHR in exact same way as https://github.com/ampproject/amphtml/blob/master/test/functional/test-xhr.js#L76-L93.
Adding this in a filename
test-document-fetcher.js
intest/functional
folder lead to breaking of test intest-preconnect.js
which modifiesXHRHttpRequest.prototype
https://github.com/ampproject/amphtml/blob/master/test/functional/test-preconnect.js#L88I tried removing as much code as possible from my test, which made me zero down the cause to using
sandbox.useFakeXMLHttpRequest()
.Looks like there was a bug in sinon itself: sinonjs/sinon#1840
And was fixed in 6.1.1
How do we reproduce the issue?
test-dummy.js
intest/functional
folder.sandbox.useFakeXMLHttpRequest()
in it and write a dummy test around XMLHttpRequest.test-preconnect.js
will fail.What browsers are affected?
None
Which AMP version is affected?
Not sure
The text was updated successfully, but these errors were encountered: