{"id":18260035,"url":"https://github.com/roppa/testu","last_synced_at":"2025-04-08T23:44:36.555Z","repository":{"id":146092866,"uuid":"99458048","full_name":"roppa/testu","owner":"roppa","description":"Test runner and assertion library","archived":false,"fork":false,"pushed_at":"2018-02-10T20:10:48.000Z","size":45,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-14T18:36:27.113Z","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":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/roppa.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"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}},"created_at":"2017-08-06T01:53:29.000Z","updated_at":"2017-09-09T07:41:44.000Z","dependencies_parsed_at":"2023-05-14T06:15:42.015Z","dependency_job_id":null,"html_url":"https://github.com/roppa/testu","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/roppa%2Ftestu","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/roppa%2Ftestu/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/roppa%2Ftestu/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/roppa%2Ftestu/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/roppa","download_url":"https://codeload.github.com/roppa/testu/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247947825,"owners_count":21023058,"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-05T10:41:38.161Z","updated_at":"2025-04-08T23:44:36.534Z","avatar_url":"https://github.com/roppa.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Testu\n\n![\u003cCircleCI status](https://circleci.com/gh/roppa/testu/tree/master.svg?style=shield\u0026circle-token=521075127823b75a66b205e0faceb138384c430d)\n\nTesting is essential to development. I've obviously used testing libraries such as Mocha, Chai, Ava, Tape, etc. But how would you go about writing one yourself? Especially how would you build a test framework using that same framework to test itself? I got to thinking, just what would a test runner or 'test harness' consist of? I thought the basics would be:\n\n- It should be able to look for test file/s and execute tests within\n- It should be able to make assertions within an executed test\n- It should be able to report successes and failures of these assertions\n\nSo we would have a command line tool. We would run and record tests and their assertions and record results into a report that is delivered as the conclusion of the tests.\n\n## Harness\n\nThe term harness, or 'test framework', is the thing that keeps track of the tests and sends the result to the reporter.\n\n## Assertions\n\nAssertions are statements of facts or beliefs. So they are binary; that an assertion is either correct or wrong. There are many styles of assertions, some prefer a string like method such as `expect(value).to.be.ok()` or simply `assert(condition)`.\n\nGeneral assertions:\n\n - 'assert', 'ok', 'isOk': truthy\n - 'assertNot', 'not', 'notOk': falsy\n - 'throws', 'throw': expect an exception to be thrown\n - 'doesNotThrow', 'notThrow': will not throw an exception\n - 'equal', 'equals', 'isEqual', 'is', 'strictEqual', 'strictEquals', 'strictIs', 'isStrict', 'isStrictly': equality condition\n - 'deepEqual', 'deepEquals', 'isDeepEqual', 'isDeep', 'strictDeepEqual', 'strictDeepEquals': object/array equality condition\n - 'notEqual', 'inequal', 'notEqual', 'notEquals', 'notStrictEqual', 'notStrictEquals', 'isNotEqual', 'isNot', 'doesNotEqual', 'isInequal': object/array not equal\n - 'notNull', 'isNotNull': specific type assertion\n\nHelper assertions:\n\n - 'isAbove', 'above', 'greaterThan', 'over': numeric value above\n - 'isBelow', 'below', 'lessThan': numeric value below\n - 'isAtLeast', 'atLeast', 'greaterThanOrEqual': numeric value less than or equal\n - 'isFalse': falsy value\n - 'isTrue': truthy value\n\nIncluded on the assert function is 'expect', so you can destructure and use the expect format:\n\n```javascript\ntest('using expect' ({ expect }) =\u003e {\n  expect(true).to.be.ok();\n  expect(0).to.equal(0);\n});\n```\n\n - 'equal': equality test\n - 'ok': truthy test\n\n## Reporter\n\nI decided to use [TAP (test anything protocol)](https://testanything.org/tap-specification.html) for the default reporter.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Froppa%2Ftestu","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Froppa%2Ftestu","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Froppa%2Ftestu/lists"}