sinonjs/sinon

Document how we can control Promises

Aperta

#1898 aperta il 9 set 2018

 (8 commenti) (0 reazioni) (0 assegnatari)JavaScript (764 fork)batch import
DocumentationHelp wantedgood first issuehacktoberfestpinned

Metriche repository

Star
 (9548 stelle)
Metriche merge PR
 (Metriche PR in attesa)

Descrizione

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 ...

Guida contributor