Socket
Book a DemoInstallSign in
Socket

flush-promises

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

flush-promises

Flush promises in tests

1.0.2
latest
Source
npmnpm
Version published
Weekly downloads
207K
-21.54%
Maintainers
1
Weekly downloads
 
Created

What is flush-promises?

The 'flush-promises' npm package is a utility designed to help with testing asynchronous code in JavaScript. It allows you to flush all pending resolved promises, making it easier to test code that relies on asynchronous operations.

What are flush-promises's main functionalities?

Flushing Promises

This feature allows you to flush all pending promises, ensuring that all asynchronous operations have completed. This is particularly useful in testing scenarios where you need to wait for all promises to resolve before making assertions.

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

async function asyncFunction() {
  return 'resolved';
}

asyncFunction().then(result => console.log(result));

flushPromises().then(() => {
  console.log('All promises have been flushed');
});

Other packages similar to flush-promises

Keywords

async

FAQs

Package last updated on 01 Nov 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.