{"id":18541445,"url":"https://github.com/kentor/flush-promises","last_synced_at":"2025-04-12T23:30:33.364Z","repository":{"id":51709825,"uuid":"91212147","full_name":"kentor/flush-promises","owner":"kentor","description":"Flush all queued resolved promise handlers","archived":false,"fork":false,"pushed_at":"2021-05-10T15:38:46.000Z","size":55,"stargazers_count":197,"open_issues_count":3,"forks_count":6,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-08T11:06:57.279Z","etag":null,"topics":["async","await","promises","testing"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kentor.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-05-14T01:18:11.000Z","updated_at":"2025-02-18T07:00:43.000Z","dependencies_parsed_at":"2022-08-03T09:00:36.169Z","dependency_job_id":null,"html_url":"https://github.com/kentor/flush-promises","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kentor%2Fflush-promises","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kentor%2Fflush-promises/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kentor%2Fflush-promises/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kentor%2Fflush-promises/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kentor","download_url":"https://codeload.github.com/kentor/flush-promises/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248647249,"owners_count":21139081,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["async","await","promises","testing"],"created_at":"2024-11-06T20:05:05.740Z","updated_at":"2025-04-12T23:30:33.344Z","avatar_url":"https://github.com/kentor.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# flush-promises\n\n[![Build Status](https://travis-ci.org/kentor/flush-promises.svg)](https://travis-ci.org/kentor/flush-promises) [![npm](https://img.shields.io/npm/v/flush-promises.svg)](https://www.npmjs.com/package/flush-promises)\n\nFlush all pending resolved promise handlers. Useful in tests.\n\n## example with async/await\n\n```js\nconst flushPromises = require('flush-promises');\n\ntest('flushPromises', async () =\u003e {\n  let a;\n  let b;\n\n  Promise.resolve().then(() =\u003e {\n    a = 1;\n  }).then(() =\u003e {\n    b = 2;\n  })\n\n  await flushPromises();\n\n  expect(a).toBe(1);\n  expect(b).toBe(2);\n});\n```\n\n## TypeScript\n\n```ts\nimport flushPromises from \"flush-promises\";\n\ntest(\"flushPromises\", async () =\u003e {\n  let a;\n  let b;\n \n  Promise.resolve().then(() =\u003e {\n    a = 1;\n  }).then(() =\u003e {\n    b = 2;\n  });\n \n  await flushPromises();\n \n  expect(a).toBe(1);\n  expect(b).toBe(2);\n});\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkentor%2Fflush-promises","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkentor%2Fflush-promises","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkentor%2Fflush-promises/lists"}