{"id":20731664,"url":"https://github.com/tapjs/tapsert","last_synced_at":"2025-04-23T22:06:22.879Z","repository":{"id":19984667,"uuid":"23251834","full_name":"tapjs/tapsert","owner":"tapjs","description":"Drop in assert replacement that produces TAP output instead of exceptions","archived":false,"fork":false,"pushed_at":"2023-03-07T09:30:12.000Z","size":224,"stargazers_count":11,"open_issues_count":2,"forks_count":2,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-04-23T22:06:14.598Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/tapsert","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/tapjs.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGES.md","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":"2014-08-23T08:41:57.000Z","updated_at":"2023-04-11T16:32:23.000Z","dependencies_parsed_at":"2024-01-28T23:43:37.000Z","dependency_job_id":null,"html_url":"https://github.com/tapjs/tapsert","commit_stats":{"total_commits":37,"total_committers":4,"mean_commits":9.25,"dds":0.3783783783783784,"last_synced_commit":"4bbd601b21393a76342faa7916e646098256b33d"},"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tapjs%2Ftapsert","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tapjs%2Ftapsert/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tapjs%2Ftapsert/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tapjs%2Ftapsert/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tapjs","download_url":"https://codeload.github.com/tapjs/tapsert/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250522298,"owners_count":21444511,"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:20.089Z","updated_at":"2025-04-23T22:06:22.183Z","avatar_url":"https://github.com/tapjs.png","language":"JavaScript","funding_links":["https://github.com/sponsors/isaacs"],"categories":[],"sub_categories":[],"readme":"tapsert [![Build Status](https://travis-ci.org/tapjs/tapsert.svg)](https://travis-ci.org/tapjs/tapsert)\n=======\n\nA total drop-in replacement for the assert module provided by Node core that\nprints TAP compliant output instead of throwing `AssertionError`s.\n\nUses\n * drop-in replacement for `assert` if you prefer bare asserts and no test\n   runner or harness but you still want TAP output (`node plain.js`)\n * drop-in replacement for `assert` if you use a TAP consuming test runner\n   but don't want to use a \"real\" test harness (`tap plain.js`)\n * stepping-stone for migrating from `assert` to `tap`\n\n## Usage\n\nUse tapsert the same as you would use assert if you don't use a test runner.\n\n### Examples\n\nStart with the assert module from node core.\n```js\nvar assert = require('assert');\nassert.equal('actual', 'expected', 'core assert style');\n```\n\nReplace `require('assert')` with `require('tapsert')` to produce TAP output.\n```js\nvar assert = require('tapsert');\nassert.equal('actual', 'expected', 'core assert style');\n```\n\nRename `assert` to `tap` to prepare for switching to [https://github.com/tapjs/node-tap](tap).\n```js\nvar tap = require('tapsert');\ntap.equal('actual', 'expected', 'tap assert style');\n```\n\nReplace `require('tapsert')` with `require('tap')` and you're using tap.\n```js\nvar tap = require('tap');\ntap.equal('actual', 'expected', 'tap assert style');\n```\n\n### Tests\n\nTests are written as simple asserts revealing full intentions.\n\n```js\n// example.js\nvar assert = require(process.env.ASSERT || './');\n\nassert(assert, 'assert exists');\nassert(assert.equal, 'assert.equal exists');\nassert.equal(typeof assert.strictEqual, 'function',\n             'assert.strictEqual is a function');\nassert.ok(false, 'really want false to be true');\nassert.doesNotThrow(function() {\n  assert.throws(function() {\n    throw Error('expected!');\n  }, /expected/, 'supports assert.throws');\n}, 'nested asserts are weird.');\n```\n\n### Output\n\nOutput shows the result of each assertion, even if there are failures:\n\n```sh\n$ node test.js\nTAP version 13\nok 1 - assert exists\nok 2 - assert.equal exists\nok 3 - assert.strictEqual is a function\nnot ok 4 - really want false to be true\n# actual: false\n# expected: true\n# operator: \"==\"\n# message: really want false to be true\n# AssertionError: really want false to be true\n#     at Function.tapifiedAssert [as ok] (/Users/ryan/work/tapsert/index.js:25:14)\n#     at Object.\u003canonymous\u003e (/Users/ryan/work/tapsert/example.js:7:8)\n#     at Module._compile (module.js:456:26)\n#     at Object.Module._extensions..js (module.js:474:10)\n#     at Module.load (module.js:356:32)\n#     at Function.Module._load (module.js:312:12)\n#     at Function.Module.runMain (module.js:497:10)\n#     at startup (node.js:119:16)\n#     at node.js:906:3\nok 6 - supports assert.throws\nok 5 - nested asserts are weird.\n\n1..6\n# tests 6\n# pass  5\n# fail  1\n\n$ echo $?\n1\n```\n\nThe same tests run with assert from node core (output captured from stderr):\n```sh\n$ ASSERT=assert node example.js\n\nassert.js:92\n  throw new assert.AssertionError({\n        ^\nAssertionError: really want false to be true\n    at Object.\u003canonymous\u003e (/Users/ryan/work/tapsert/example.js:7:8)\n    at Module._compile (module.js:456:26)\n    at Object.Module._extensions..js (module.js:474:10)\n    at Module.load (module.js:356:32)\n    at Function.Module._load (module.js:312:12)\n    at Function.Module.runMain (module.js:497:10)\n    at startup (node.js:119:16)\n    at node.js:906:3\n\n$ echo $?\n8\n```\n\n---\n\u0026copy; 2014 Ryan Graham\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftapjs%2Ftapsert","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftapjs%2Ftapsert","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftapjs%2Ftapsert/lists"}