{"id":24134982,"url":"https://github.com/wipodev/witests","last_synced_at":"2026-05-18T09:06:08.943Z","repository":{"id":265790969,"uuid":"896637639","full_name":"wipodev/witests","owner":"wipodev","description":"A simple and extensible testing library","archived":false,"fork":false,"pushed_at":"2025-04-16T21:24:59.000Z","size":9,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-06T23:57:35.440Z","etag":null,"topics":["nodejs","testing","tests","unit-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/wipodev.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2024-11-30T22:29:52.000Z","updated_at":"2025-04-16T21:25:03.000Z","dependencies_parsed_at":"2025-04-16T22:42:53.807Z","dependency_job_id":"3e447cb6-f49f-4682-9553-8373bb30e453","html_url":"https://github.com/wipodev/witests","commit_stats":null,"previous_names":["wipodev/witests"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/wipodev/witests","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wipodev%2Fwitests","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wipodev%2Fwitests/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wipodev%2Fwitests/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wipodev%2Fwitests/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wipodev","download_url":"https://codeload.github.com/wipodev/witests/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wipodev%2Fwitests/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33172173,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-18T05:43:36.989Z","status":"ssl_error","status_checked_at":"2026-05-18T05:43:19.133Z","response_time":71,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["nodejs","testing","tests","unit-testing"],"created_at":"2025-01-12T01:18:37.694Z","updated_at":"2026-05-18T09:06:08.926Z","avatar_url":"https://github.com/wipodev.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# WiTests\n\n**WiTests** is a lightweight, simple, and extensible testing library for Node.js projects. It allows you to define and run tests with a focus on clear organization and easy debugging.\n\n## Features\n\n- Group tests by files with automatic organization.\n- Support for both single tests and test cases.\n- Customizable color-coded output for better readability.\n- Handles both success and error scenarios.\n- Reports results per file and globally.\n\n---\n\n## Installation\n\nInstall `WiTests` as a dependency in your project:\n\n```bash\nnpm install witests\n```\n\n## Usage\n\n### 1. Writing Tests\n\nCreate test files (e.g., `example.test.js`) in your designated `tests` folder. Use the `define` and `defineTestCases` functions to register your tests:\n\n```js\n// example.test.js\n\ndefine(\"Basic addition\", () =\u003e 1 + 2, 3);\n\ndefine(\n  \"Addition with nulls\",\n  () =\u003e {\n    if (1 + null === null) throw new Error(\"Nulls cannot be summed\");\n  },\n  { error: \"Nulls cannot be summed\" }\n);\n\ndefineTestCases(\"Sum of numbers\", (a, b) =\u003e a + b, {\n  case1: { input: [1, 2], expected: 3 },\n  case2: { input: [null, 2], expected: { error: \"Nulls cannot be summed\" } },\n});\n```\n\n### 2. Running Tests\n\nRun all tests in the specified folder (`tests` by default) or a single file using the CLI.\n\n```bash\nwitests\n```\n\nRunning a single test file\n\n```bash\nwitests ./tests/example.test.js\n```\n\n### 3. Output Example\n\nWhen you run the tests, `WiTests` will provide a detailed report:\n\n```bath\nRunning WiTests...\n\nRunning tests from: example.test.js\nRunning test: Basic addition...\nTest Basic addition passed! ✔️\nRunning test: Addition with nulls...\nTest Addition with nulls passed! ✔️\nRunning test: Sum of numbers - case1...\nTest Sum of numbers - case1 passed! ✔️\nRunning test: Sum of numbers - case2...\nTest Sum of numbers - case2 passed! ✔️\n\nAll tests from example.test.js passed! 🎉\nAll tests passed globally! 🎉\n```\n\n## API Reference\n\n### `define(name, testFn, expected)`\n\nDefine a single test.\n\n- `name` (string): The name of the test.\n- `testFn` (function): The test function to execute.\n- `expected` (any): The expected result. Use `{ error: \"Error message\" }` for error tests.\n\n### `defineTestCases(name, testFn, cases)`\n\nDefine multiple tests from a collection of cases.\n\n- `name` (string): The base name for the tests.\n- `testFn` (function): The test function to execute.\n- `cases` (object): An object where keys are case names and values contain:\n  - `input` (array): The input arguments for the test function.\n  - `expected` (any): The expected result.\n\n### `witestsRunner.run()`\n\nRuns all registered tests, grouping results by file.\n\n## Customization\n\n### Colors\n\nYou can customize the output colors by passing an options object when creating the runner:\n\n```js\nconst witestsRunner = new WitestsRunner({\n  colors: {\n    success: \"\\x1b[32m\",\n    failure: \"\\x1b[31m\",\n    title: \"\\x1b[35m\",\n    reset: \"\\x1b[0m\",\n  },\n});\n```\n\n## License\n\nMIT License. See [LICENSE](https://github.com/wipodev/witests/blob/main/LICENCE) for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwipodev%2Fwitests","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwipodev%2Fwitests","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwipodev%2Fwitests/lists"}