All Projects → kentor → flush-promises

kentor / flush-promises

Licence: MIT license
Flush all queued resolved promise handlers

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to flush-promises

Swiftcoroutine
Swift coroutines for iOS, macOS and Linux.
Stars: ✭ 690 (+301.16%)
Mutual labels:  promises, await
combine-promises
Like Promise.all(array) but with an object instead of an array.
Stars: ✭ 181 (+5.23%)
Mutual labels:  promises, await
P Map
Map over promises concurrently
Stars: ✭ 639 (+271.51%)
Mutual labels:  promises, await
ProtoPromise
Robust and efficient library for management of asynchronous operations in C#/.Net.
Stars: ✭ 20 (-88.37%)
Mutual labels:  promises, await
Modern Async
A modern JavaScript tooling library for asynchronous operations using async/await and promises
Stars: ✭ 31 (-81.98%)
Mutual labels:  promises, await
Swimmer
🏊 Swimmer - An async task pooling and throttling utility for JS
Stars: ✭ 94 (-45.35%)
Mutual labels:  promises, await
Breeze
Javascript async flow control manager
Stars: ✭ 38 (-77.91%)
Mutual labels:  promises, await
Hydra
⚡️ Lightweight full-featured Promises, Async & Await Library in Swift
Stars: ✭ 1,954 (+1036.05%)
Mutual labels:  promises, await
tsubaki
💮 Promisify with native promises
Stars: ✭ 18 (-89.53%)
Mutual labels:  promises
async-airtable
A lightweight npm package to handle working with the Airtable API.
Stars: ✭ 48 (-72.09%)
Mutual labels:  promises
relaks
Asynchrounous React component
Stars: ✭ 49 (-71.51%)
Mutual labels:  await
Promise.allSettled
ES Proposal spec-compliant shim for Promise.allSettled
Stars: ✭ 93 (-45.93%)
Mutual labels:  await
synchronicity
Synchronicity lets you interoperate with asynchronous Python APIs.
Stars: ✭ 41 (-76.16%)
Mutual labels:  await
best-queue
Queue in runtime based promise
Stars: ✭ 26 (-84.88%)
Mutual labels:  await
hxasync
This library allows you to add "async" and "await" keywords in Python and JavaScript code almost the same way you would do it in the native code.
Stars: ✭ 21 (-87.79%)
Mutual labels:  await
node-pagerduty
⛔️ DEPRECATED - PagerDuty v2 API Wrapper for Node
Stars: ✭ 19 (-88.95%)
Mutual labels:  promises
node-pg-large-object
Large object support for PostgreSQL clients using the node-postgres library.
Stars: ✭ 31 (-81.98%)
Mutual labels:  promises
ws-promise
A tiny, Promise-based WebSocket protocol allowing request-response usage in ECMAScript
Stars: ✭ 20 (-88.37%)
Mutual labels:  await
is-async-function
Is this a native `async function`?
Stars: ✭ 17 (-90.12%)
Mutual labels:  await
of
🍬 Promise wrapper with sugar 🍬
Stars: ✭ 13 (-92.44%)
Mutual labels:  await

flush-promises

Build Status npm

Flush all pending resolved promise handlers. Useful in tests.

example with async/await

const flushPromises = require('flush-promises');

test('flushPromises', async () => {
  let a;
  let b;

  Promise.resolve().then(() => {
    a = 1;
  }).then(() => {
    b = 2;
  })

  await flushPromises();

  expect(a).toBe(1);
  expect(b).toBe(2);
});

TypeScript

import flushPromises from "flush-promises";

test("flushPromises", async () => {
  let a;
  let b;
 
  Promise.resolve().then(() => {
    a = 1;
  }).then(() => {
    b = 2;
  });
 
  await flushPromises();
 
  expect(a).toBe(1);
  expect(b).toBe(2);
});
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].