{"id":18573914,"url":"https://github.com/basedwon/testr","last_synced_at":"2025-10-14T14:12:49.567Z","repository":{"id":180298037,"uuid":"664927001","full_name":"basedwon/testr","owner":"basedwon","description":"Testr is a flexible, lightweight and based testing library for JavaScript. It's designed to work seamlessly in both browser and Node.js environments.","archived":false,"fork":false,"pushed_at":"2023-12-05T07:56:05.000Z","size":35,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-17T14:48:24.360Z","etag":null,"topics":["browser","chai","js","nodejs","test-runner","testing"],"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/basedwon.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":"docs/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}},"created_at":"2023-07-11T04:10:53.000Z","updated_at":"2023-07-20T01:44:04.000Z","dependencies_parsed_at":null,"dependency_job_id":"20835cef-875f-464e-ac70-70435546ad3b","html_url":"https://github.com/basedwon/testr","commit_stats":{"total_commits":29,"total_committers":1,"mean_commits":29.0,"dds":0.0,"last_synced_commit":"28b8f5a673598f7b3d7c7fa0afe753c1bb6f41c0"},"previous_names":["basedwon/testr"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/basedwon%2Ftestr","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/basedwon%2Ftestr/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/basedwon%2Ftestr/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/basedwon%2Ftestr/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/basedwon","download_url":"https://codeload.github.com/basedwon/testr/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254442368,"owners_count":22071863,"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":["browser","chai","js","nodejs","test-runner","testing"],"created_at":"2024-11-06T23:13:22.860Z","updated_at":"2025-10-14T14:12:44.545Z","avatar_url":"https://github.com/basedwon.png","language":"JavaScript","readme":"# Testr\n\n\u003e gitr done, testr first\n\n[![npm](https://img.shields.io/npm/v/@basd/testr?style=flat\u0026logo=npm)](https://www.npmjs.com/package/@basd/testr)\n[![pipeline](https://gitlab.com/basedwon/testr/badges/master/pipeline.svg)](https://gitlab.com/basedwon/testr/-/pipelines)\n[![license](https://img.shields.io/npm/l/@basd/testr)](https://gitlab.com/basedwon/testr/-/blob/master/LICENSE)\n[![downloads](https://img.shields.io/npm/dw/@basd/testr)](https://www.npmjs.com/package/@basd/testr) \n\n[![Gitlab](https://img.shields.io/badge/Gitlab%20-%20?logo=gitlab\u0026color=%23383a40)](https://gitlab.com/basedwon/testr)\n[![Github](https://img.shields.io/badge/Github%20-%20?logo=github\u0026color=%23383a40)](https://github.com/basedwon/testr)\n[![Twitter](https://img.shields.io/badge/@basdwon%20-%20?logo=twitter\u0026color=%23383a40)](https://twitter.com/basdwon)\n[![Discord](https://img.shields.io/badge/Basedwon%20-%20?logo=discord\u0026color=%23383a40)](https://discordapp.com/users/basedwon)\n\nTestr is a flexible, lightweight and based testing library for JS. It's designed to work seamlessly in both browser and Node.js environments. It supports a variety of features such as nesting, asynchronous execution, and exclusion/inclusion of test cases to streamline your testing workflow.\n\n## Installation\n\nTo install Testr, use npm:\n\n```sh\nnpm i -D @basd/testr\n```\n\n## Usage\n\n### Basic Usage\n\nHere is a simple example of using Testr:\n\n```js\nconst Testr = require('@basd/testr')\n\nconst testr = new Testr()\n\ntestr.describe('A test suite', () =\u003e {\n  testr.it('A test case', () =\u003e {\n    if (1 + 1 !== 2) {\n      throw new Error('Math is broken!')\n    }\n    expect(2 + 2).to.equal(4)\n  })\n})\n\ntestr.run()\n```\nOr you can instantiate and destructure the functions you need:\n\n```js\nconst { describe, it, before, after, expect, assert, run, testr } = new Testr()\n// or as a function\nconst { describe, it, before, after, expect, assert, run, testr } = Testr()\n// which means you can do this:\nconst { describe, it, before, after, expect, assert, run, testr } = require('@basd/testr')()\n```\n\nIn this example, we create a test suite with `describe()`, add a test case with `it()`, and run our tests with `run()`.\n\n### Skipping and Only Running Certain Tests\n\nYou can also mark test cases or suites to be skipped with `describe.omit()` and `it.omit()`, or to be the only ones run with `describe.only()` and `it.only()`.\n\n```js\ndescribe.omit('A skipped test suite', () =\u003e {\n  it('A skipped test case', () =\u003e {})\n})\n\ndescribe.only('A test suite to run alone', () =\u003e {\n  it.only('A test case to run alone', () =\u003e {})\n})\n```\n\n### Before and After Hooks\n\nYou can use `before.each()`, `after.each()`, `before.all()`, and `after.all()` to set up and tear down for tests:\n\n```js\ndescribe('A test suite', () =\u003e {\n  let counter = 0\n  \n  before.each(() =\u003e {\n    counter = 1\n  })\n  \n  it('A test case', () =\u003e {\n    if (counter !== 1) {\n      throw new Error('Counter not initialized!')\n    }\n  })\n  \n  after.each(() =\u003e {\n    counter = 0\n  })\n})\n```\n\n### Node.js Environment\n\nFor Node.js environments, `TestrNode` provides additional functionality:\n\n```js\nconst TestrNode = require('@basd/testr')\n\nTestrNode.explode('path/to/tests', ['path/to/tests/to/ignore'])\n```\n\nIn this example, `TestrNode` will automatically find and require test files in the specified directory that end with `.test.js`, and ignore the ones in the directories to ignore.\n\n### CLI Usage\n\nIf you have installed Testr globally or in your project, you can use the `testr` command to run your tests from the command line:\n\n```sh\n# Run all test files in a directory\ntestr path/to/tests\n\n# Run all test files, except those in certain directories (coming soon..)\ntestr path/to/tests --ignore path/to/tests/to/ignore\n```\n\nThis will automatically find and run any files ending with `.test.js`.\n\n## Contributing\n\nContributions are welcome! Please open an issue if you encounter any problems, or a pull request if you make a change.\n\n## Donations\n\nIf you find this project useful and want to help support further development, please send us some coin. We greatly appreciate any and all contributions. Thank you!\n\n**Bitcoin (BTC):**\n```\n1JUb1yNFH6wjGekRUW6Dfgyg4J4h6wKKdF\n```\n\n**Monero (XMR):**\n```\n46uV2fMZT3EWkBrGUgszJCcbqFqEvqrB4bZBJwsbx7yA8e2WBakXzJSUK8aqT4GoqERzbg4oKT2SiPeCgjzVH6VpSQ5y7KQ\n```\n\n## License\n\n@basd/testr is [MIT licensed](https://gitlab.com/basedwon/testr/-/blob/master/LICENSE).\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbasedwon%2Ftestr","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbasedwon%2Ftestr","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbasedwon%2Ftestr/lists"}