{"id":18814344,"url":"https://github.com/n2geoff/testit","last_synced_at":"2025-04-10T14:10:08.227Z","repository":{"id":50636281,"uuid":"127577351","full_name":"n2geoff/testit","owner":"n2geoff","description":"Test small things, with a small thing","archived":false,"fork":false,"pushed_at":"2025-03-25T00:46:53.000Z","size":333,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-25T01:31:23.772Z","etag":null,"topics":["bdd-style","minimalist","single-file","test-framework","testing","testing-tools"],"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/n2geoff.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"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,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-03-31T22:46:49.000Z","updated_at":"2025-03-25T00:46:57.000Z","dependencies_parsed_at":"2024-03-02T14:24:39.339Z","dependency_job_id":"f4d06661-cebc-44f1-bf8e-7ed1523968f0","html_url":"https://github.com/n2geoff/testit","commit_stats":{"total_commits":57,"total_committers":1,"mean_commits":57.0,"dds":0.0,"last_synced_commit":"ac5626cd25fc5b0401ce8c57b0b69dd28c40843c"},"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/n2geoff%2Ftestit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/n2geoff%2Ftestit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/n2geoff%2Ftestit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/n2geoff%2Ftestit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/n2geoff","download_url":"https://codeload.github.com/n2geoff/testit/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248232301,"owners_count":21069487,"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":["bdd-style","minimalist","single-file","test-framework","testing","testing-tools"],"created_at":"2024-11-07T23:40:18.252Z","updated_at":"2025-04-10T14:10:08.207Z","avatar_url":"https://github.com/n2geoff.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Test.it\n\n\u003e A minimalistic client-side testing library\n\n**Test.it** is a small client-side testing library for people that want to live in code, not in tests.  No over engineering here.  Inspired by the simplicity of libraries like [Jasmine](https://jasmine.github.io/), but implementation ideas based on [TinyTest](https://github.com/joewalnes/jstinytest)\n\nThis is probally not a *cure-all* testing solution, if you want something more robust checkout [Jasmine](https://jasmine.github.io/), [Tape](https://github.com/substack/tape) or [Mocha](https://mochajs.org/) -- this is to...\n\n**Test small things, with small things**\n\n### Features\n\n- Designed for the Browser\n- *Under* a 100 lines\n- Single File\n- No Dependicies\n- 2kb footprint (*before gzip*)\n- Extend with custom reporters\n- Uses Simple Assert\n\n**No Bloat Here!**\n\n- [Download Here](https://raw.githubusercontent.com/n2geoff/testit/master/src/testit.js)\n- [Or Minified  Version Here](https://raw.githubusercontent.com/n2geoff/testit/master/src/testit.min.js)\n\n## Usage\n\nBy default, you can run your tests like\n\n```js\nimport test from 'testit';\n\ntest.it({\n    'my passing test'() {\n        test.assert(true);\n    },\n    'my failing test'() {\n        test.assert(true === false, 'just wanted to fail fast');\n    }\n}).run();\n```\n\u003e NOTE: `run()` can be called elsewhere, see [tests/](test/run.html)\n\nby default, your test results are logged to the console\n\n```\n+OK my passing test\n-ERR my failing test\n---\nError: just wanted to fail fast\n    ...error stack...\n---\n\n# tests 2 pass 1 fail 1\n```\n\nA `+OK` will proceed test lines that *pass* and a `-ERR` for those that *fail*, An error stack is included by default after the failing test wrapped in `---`.  You can suppress outputing the error stack by passing `false` as an argument to `run()`, ie `run(false)`.\n\nYou can, also, write your own custom test runner...\n\n### Custom Test Runners\n\n`test.it` `.run()` method provides an optional `next` function parameter that passes the results as an `object` for you to process *however* you like.\n\nFor Example...\n\n**For Fans of [TinyTest](https://github.com/joewalnes/jstinytest)**\n\n```js\ntest.it({\n    'my passing test'() {\n        test.assert(true);\n    }\n}, (results) =\u003e {\n    if (window.document \u0026\u0026 document.body) {\n        document.body.style.backgroundColor = (\n            results.fail.length ? '#ff9999' : '#99ff99'\n        );\n    }\n});\n```\n\nIf using the optional `next` param will return results as JSON\n\n```json\n{\n    \"pass\": [\"list of passed tests\", \"...\"],\n    \"fail\": [\"list of errored tests\", \"...\"],\n}\n```\n\nFrom this object you can easily find the number of tests ran `pass.length`, number of failed tests `fail.length` or the total test count by adding the two.  Simple.\n\n\u003e REMEMBER: you can bypass error output too\n\nA sample test runner is provided for the **BROWSER** in the `test/` directory; `index.html` and `runner.js` respectfully, with the spec in `index.spec.js`.\n\n## Methods\n\nTo stay minimal, `test.it` only has 3 core functions:\n- `it` to capture your tests\n- `run` to execute yours tests\n- and `assert` to write your assertions\n\nWhile you can use your own assertion library, the included `assert` evaluates an expression/condition tests:\n\nif you want to shorten test typing try\n\n    let assert = test.assert;\n\nputting that above your tests will allow you to write like\n\n```js\ntest.it({\n    \"my test should work\"() {\n        assert(true);\n    }\n});\n\n```\n\n## TODO\n\n- provide sample test runner for CI environments\n- maybe spec files export results \u0026\u0026 runner identifies failure\n\n## Support\n\nPlease open [an issue](https://github.com/n2geoff/testit/issues/new) for support.\n\n## Contributing\n\nAnyone is welcome to contribute, however, if you decide to get involved, please take a moment to review the [guidelines](CONTRIBUTING.md), they're minimalistic;)\n\n## License\n\n[MIT](LICENSE) Geoff Doty\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fn2geoff%2Ftestit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fn2geoff%2Ftestit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fn2geoff%2Ftestit/lists"}