Sinon.JS has a few utilities used internally in lib/sinon.js. Unless the method in question is documented here, it should not be considered part of the public API, and thus is subject to change.

Utils API


Creates a new object with the given function as the protoype and stubs all implemented functions.

    class Container {
        contains(item) { /* ... */ }

    var stubContainer = sinon.createStubInstance(Container);

The given constructor function is not invoked. See also the stub API.


Formats an object for pretty printing in error messages using formatio. Feel free to override this method with your own implementation if you prefer different visualization of e.g. objects. The method should return a string.