{"id":20731662,"url":"https://github.com/tapjs/tapromise","last_synced_at":"2025-07-06T20:32:27.086Z","repository":{"id":66000900,"uuid":"51814504","full_name":"tapjs/tapromise","owner":"tapjs","description":"Turn any tap Test object into a promise-resolving thingie","archived":false,"fork":false,"pushed_at":"2022-02-26T20:27:56.000Z","size":92,"stargazers_count":13,"open_issues_count":4,"forks_count":1,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-06-17T07:07:44.171Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"isc","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tapjs.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null},"funding":{"github":["isaacs"]}},"created_at":"2016-02-16T06:49:07.000Z","updated_at":"2022-02-26T20:27:02.000Z","dependencies_parsed_at":"2023-02-28T11:00:27.571Z","dependency_job_id":null,"html_url":"https://github.com/tapjs/tapromise","commit_stats":{"total_commits":21,"total_committers":2,"mean_commits":10.5,"dds":0.04761904761904767,"last_synced_commit":"8ee7365c5070fdca6c62e9f08c890c311ffc83e2"},"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/tapjs/tapromise","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tapjs%2Ftapromise","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tapjs%2Ftapromise/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tapjs%2Ftapromise/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tapjs%2Ftapromise/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tapjs","download_url":"https://codeload.github.com/tapjs/tapromise/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tapjs%2Ftapromise/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262393443,"owners_count":23304120,"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":[],"created_at":"2024-11-17T05:16:19.063Z","updated_at":"2025-07-06T20:32:27.041Z","avatar_url":"https://github.com/tapjs.png","language":"JavaScript","funding_links":["https://github.com/sponsors/isaacs"],"categories":[],"sub_categories":[],"readme":"# tapromise\n\nTurn any tap Test object into a promise-resolving thingie\n\n[![Build Status](https://travis-ci.org/tapjs/tapromise.svg?branch=master)](https://travis-ci.org/tapjs/tapromise)\n\nIf you're using [tap](http://npm.im/tap) for tests, and those test\ninteract with a lot of Promises, sometimes it's nice to be able to do\nasserts against those objects by resolving them first.\n\nThis will work just fine with any version of [tap](http://npm.im/tap)\nor [tape](http://npm.im/tape).\n\nHowever, tap version 5.5 or greater is strongly recommended because:\n\n1. You don't have to `.then(function() { t.end() })` if you return a\n   promise from a `tap` test function, because it groks promises as\n   return values.\n2. The `at` and `stack` fields will be set in a useful way in tap 5.5\n   and higher, so that failures will point at the proper line in your\n   test script, rather than in some obscure place inside this module.\n\nUse it like so:\n\n```javascript\nvar tapromise = require('tapromise')\nvar t = require('tap')\n\nt.test('whoa lotta promises!', function (t) {\n  t = tapromise(t)\n  return Promise.all([\n    t.equal(promiseToBeTen(), 10),\n    t.ok(Promise.resolve(true)),\n    t.match(Promise.resolve({ a: 1 }), { a: 1 })\n  ])\n})\n```\n\nThis has the following effects:\n\n1. A `tapromise` object has all the same assert methods as the `Test`\n   object passed to it.\n2. Every assert method on the `tapromise` object resolves all Promises\n   passed to it, and returns a Promise.\n3. When all the promises resolve, it runs the assert on the data.\n\nSo, the above code would be equivalent to:\n\n```javascript\nvar t = require('tap')\n\nt.test('whoa lotta promises!', function (t) {\n  return promiseToBeTen().then(function (ten) {\n    t.equal(ten, 10)\n    return Promise.resolve(true)\n  }).then(function (shouldBeTrue) {\n    t.ok(shouldBeTrue)\n    return Promise.resolve({ a: 1 })\n  }).then(function (obj) {\n    t.match(obj, { a: 1 })\n  })\n})\n```\n\nThis reduces a lot of the Promise boilerplate.  If you are testing an\nAPI that uses Promises extensively to return data (for example,\nSelenium), then this can be very convenient.\n\nNote that this means you can't ever test that an object *is* a\nPromise, since the tapromise object will resolve everything it\nreceives.\n\n## API\n\n* `tapromise(test, [options])` Returns a `tapromise` object with\n  methods corresponding to all methods on the `tap.Test` argument that\n  accept Promises as args and returns a Promise that resolves when the\n  assert has been made.\n\n  * `options.exclude` A list of method names to expose, but *not* wrap\n    in promise-resolving behavior.  Note that this means those methods\n    will probably execute synchronously and not return a promise.\n\n    You can use this if there are test methods you want to be able to\n    call right away.  It's also especially useful if you want to be\n    able to assert that a thing is a Promise, without automatically\n    resolving it.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftapjs%2Ftapromise","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftapjs%2Ftapromise","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftapjs%2Ftapromise/lists"}