sinonjs/sinon

Document how we can control Promises

Open

#1898 opened on Sep 9, 2018

View on GitHub
 (8 comments) (0 reactions) (0 assignees)JavaScript (9,548 stars) (764 forks)batch import
DocumentationHelp wantedgood first issuehacktoberfestpinned

Description

There have been a couple of longstanding issues and pull requests regarding Promises on the lolex issue tracker.

I am assuming we will probably implement https://github.com/sinonjs/lolex/issues/114 in time, for a totally synchronous way to control Promises, but for it to work fully in true ES2017+ environments using asynchronous/await it requires explicit support from the underlying engine.

Before it's implemented we should document for people how they can control Promises today in "normal" cases. We can't cover all cases (as mentioned above), but we could perhaps make a tutorial to show a possible path. I don't care about pretty in this regard, but results, so if it involves overriding Promise.prototype, installing Bluebird or other non-core Sinon libs that's ok. It's just about covering how to achieve a common desire, like the proxyquire article shows.

I am not totally sure how or what, but something ...

Contributor guide