{"id":31799544,"url":"https://github.com/hhhhhhhhhn/itworks","last_synced_at":"2026-05-14T21:34:44.988Z","repository":{"id":57278666,"uuid":"240739967","full_name":"hhhhhhhhhn/itworks","owner":"hhhhhhhhhn","description":"A simple node unit testing library.","archived":false,"fork":false,"pushed_at":"2020-05-31T18:22:05.000Z","size":19,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-09-09T06:32:07.893Z","etag":null,"topics":["node","node-module","nodejs","unit-testing","unittest"],"latest_commit_sha":null,"homepage":null,"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/hhhhhhhhhn.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}},"created_at":"2020-02-15T15:42:32.000Z","updated_at":"2020-07-28T22:38:28.000Z","dependencies_parsed_at":"2022-09-09T14:10:43.226Z","dependency_job_id":null,"html_url":"https://github.com/hhhhhhhhhn/itworks","commit_stats":null,"previous_names":["oekshido/itworks"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/hhhhhhhhhn/itworks","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hhhhhhhhhn%2Fitworks","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hhhhhhhhhn%2Fitworks/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hhhhhhhhhn%2Fitworks/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hhhhhhhhhn%2Fitworks/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hhhhhhhhhn","download_url":"https://codeload.github.com/hhhhhhhhhn/itworks/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hhhhhhhhhn%2Fitworks/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279005470,"owners_count":26083900,"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","status":"online","status_checked_at":"2025-10-10T02:00:06.843Z","response_time":62,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["node","node-module","nodejs","unit-testing","unittest"],"created_at":"2025-10-10T22:19:37.070Z","updated_at":"2025-10-10T22:19:38.412Z","avatar_url":"https://github.com/hhhhhhhhhn.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# itworks\nA simple node unit testing library. It is completly error driven and doesn't need any additional dependencies.\n\n## Installation\n```\nnpm install --save-dev itworksjs\n```\n\n## Usage\nCreate a test file, and set it as `npm test` in the `package.json` file. In the test file, follow this example:\n```javascript\nconst {it, works} = require(\"itworksjs\")\n\nit(\"should be able to evaluate expressions\", ()=\u003e{\n    if(1+1*2 != 3){\n        throw new Error(`Evaluated 1+1*2 as ${1+1*2} instead of 3`)\n    }\n})\n\nit(\"should think 1+1=3\",()=\u003e{\n    if(1+1 != 3){\n        throw new Error(`Evaluated 1+1 as ${1+1} instead of 3`)\n    }\n})\n\nworks()\n```\nThen, when testing\n```\n[O]: It should be able to evaluate expressions\n[X]: It should think 1+1=3 FAILED: Evaluated 1+1 as 2 instead of 3\nTests Finished, Result: 1/2 Passed    \n```\n---\nExample using `functions`\n\n```javascript\n// tested.js\nfunction a(y,z){\n    return z+y\n}\n\nfunction b(y,z){\n    return y-z\n}\n\nmodule.exports = {a:a}\n\n// test.js\nconst {it, works, functions} = require(\"itworksjs\")\n\nconst {a,b} = functions([\"a\", \"b\"]).from(\"./tested.js\")\n\nit(\"should be able to add\", ()=\u003e{\n    if(a(1,1) != 2){\n        throw new Error(`a(1,1) = ${a(1,1)}`)\n    }\n})\n\nit(\"should be able to substract\", ()=\u003e{\n    if(b(3,4) != -1){\n        throw new Error(`b(3,4) = ${b(3,4)}`)\n    }\n})\n\nworks()\n```\nWhich gives the result:\n```\n[O]: It should be able to add\n[O]: It should be able to substract\n\nTests Finished, Result: 2/2 Passed\n\nIt Works!\n```\n\n## Functions\n- `it(message, code)`: Takes a message (text displayed when testing and identifier) and a function, and adds it to a global `tests` object (which is created if it doesn't already exist).\n\n- `works()`: Tests all functions in the `tests` object, considers them failed if they throw an error (which is displayed). The function also returns [passedTests, totalTests].\n\n- `functions(functionlist).from(file)`: Similar to the require function. Imports the functions (given as an array of strings) even if they are not in `module.exports`.\n\n- `arrayEquals(array1, array2)`: Checks recursively if two arrays are equal.\n\n---\n### Note\n`console` functions were replaced with empty ones, to suppress console logs. Use the new `console.print` function instead. ","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhhhhhhhhhn%2Fitworks","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhhhhhhhhhn%2Fitworks","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhhhhhhhhhn%2Fitworks/lists"}