{"id":16439144,"url":"https://github.com/posva/faked-promise","last_synced_at":"2025-09-10T15:40:01.774Z","repository":{"id":28769378,"uuid":"119279890","full_name":"posva/faked-promise","owner":"posva","description":"Create a fake promise that can be resolve and rejected programatically","archived":false,"fork":false,"pushed_at":"2024-12-13T21:36:08.000Z","size":678,"stargazers_count":12,"open_issues_count":2,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-12-28T10:02:32.523Z","etag":null,"topics":["mock","promise","testing"],"latest_commit_sha":null,"homepage":null,"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/posva.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":".github/CONTRIBUTING.md","funding":".github/funding.yml","license":"LICENSE","code_of_conduct":".github/CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"posva"}},"created_at":"2018-01-28T17:13:06.000Z","updated_at":"2024-11-04T03:22:12.000Z","dependencies_parsed_at":"2024-05-31T23:44:21.890Z","dependency_job_id":"470cc91a-8eb8-406c-900c-c11bee0e8574","html_url":"https://github.com/posva/faked-promise","commit_stats":{"total_commits":143,"total_committers":5,"mean_commits":28.6,"dds":0.4755244755244755,"last_synced_commit":"adb8cddb6f92f5c87e21e7f0f53bdd66e077b90b"},"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/posva%2Ffaked-promise","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/posva%2Ffaked-promise/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/posva%2Ffaked-promise/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/posva%2Ffaked-promise/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/posva","download_url":"https://codeload.github.com/posva/faked-promise/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":232615206,"owners_count":18550648,"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":["mock","promise","testing"],"created_at":"2024-10-11T09:08:09.734Z","updated_at":"2025-09-10T15:40:01.711Z","avatar_url":"https://github.com/posva.png","language":"JavaScript","funding_links":["https://github.com/sponsors/posva"],"categories":[],"sub_categories":[],"readme":"# faked-promise [![Build Status](https://img.shields.io/circleci/project/posva/faked-promise/master.svg)](https://circleci.com/gh/posva/faked-promise) [![npm package](https://img.shields.io/npm/v/faked-promise.svg)](https://www.npmjs.com/package/faked-promise) [![coverage](https://img.shields.io/codecov/c/github/posva/faked-promise.svg)](https://codecov.io/github/posva/faked-promise) [![thanks](https://img.shields.io/badge/thanks-%E2%99%A5-ff69b4.svg)](https://github.com/posva/thanks)\n\n\u003e Create a promise that can be resolved and rejected programatically outside of it\n\nIt basically extracts the `resolve` and `reject` callbacks so you can call them whenever you need.\n⚠️ The promise can only be resolved once, it's still a regular Promise after all.\n\n\u003e [!TIP]\n\u003e In modern environments, you can directly use [`Promise.withResolvers()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/withResolvers)\n\n## Installation\n\n```sh\nnpm i faked-promise\n```\n\n## Usage\n\nfaked-promise exports one single function that takes no arguments and returns an array with 3 elements:\n\n- A real promise\n- Its `resolve` callback\n- Its `reject` callback\n\nMeaning you can control exactly when the promise is resolved or rejected:\n\n```js\nconst fakePromise = require('faked-promise')\n\nconst [promise, resolve, reject] = fakePromise()\npromise.then(() =\u003e {})\nresolve('any value')\n```\n\n## License\n\n[MIT](http://opensource.org/licenses/MIT)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fposva%2Ffaked-promise","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fposva%2Ffaked-promise","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fposva%2Ffaked-promise/lists"}