1
我试图用sinon.js与此代码(requirebin)上的WebSocket建设窥探窥探:兴农上的WebSocket
sinon = require('sinon');
sinon.spy(window, 'WebSocket');
// throws an error (see console)
new window.WebSocket("ws://example.com");
在Chrome中失败与Uncaught TypeError: Failed to construct 'WebSocket': Please use the 'new' operator, this DOM object constructor cannot be called as a function.
在Safari或者不与PhantomJs TypeError: Attempted to wrap object property WebSocket as function
我在做什么错?