{"id":21076083,"url":"https://github.com/shaack/teevi","last_synced_at":"2025-03-14T03:43:10.557Z","repository":{"id":41357954,"uuid":"112475290","full_name":"shaack/teevi","owner":"shaack","description":"Allows unit testing of ES6 modules without additional dependencies right in your browser.","archived":false,"fork":false,"pushed_at":"2023-04-09T18:48:36.000Z","size":48,"stargazers_count":0,"open_issues_count":2,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-08T10:51:58.124Z","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":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/shaack.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}},"created_at":"2017-11-29T12:54:40.000Z","updated_at":"2022-06-11T11:26:50.000Z","dependencies_parsed_at":"2024-10-04T14:39:59.007Z","dependency_job_id":"88fcd8c5-e7a4-4e08-b398-a935c6be7b23","html_url":"https://github.com/shaack/teevi","commit_stats":null,"previous_names":["shaack/svjs-test"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shaack%2Fteevi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shaack%2Fteevi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shaack%2Fteevi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shaack%2Fteevi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/shaack","download_url":"https://codeload.github.com/shaack/teevi/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243521242,"owners_count":20304183,"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-19T19:26:32.000Z","updated_at":"2025-03-14T03:43:10.527Z","avatar_url":"https://github.com/shaack.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Teevi\n\nTired of installing 1000 dependencies, just to run unit tests? Teevi is\nthe essence of unit testing in JavaScript.\n\nIt allows unit testing of JS without additional dependencies, right in your browser.\nTeevi has almost the same syntax as Mocha with Chai but is a hundred times smaller.\n\nDemo: [http://shaack.com/projekte/teevi/test/](http://shaack.com/projekte/teevi/test/)\n\n## Usage\n\n1. Create the test script `MyTest.js`\n\n```javascript\nimport {describe, it, assert} from \"../src/teevi.js\";\n\ndescribe(\"Teevi test demo\", () =\u003e {\n    it(\"will not fail\", () =\u003e {\n        assert.true(2 * 2 === 4)\n    })\n    it(\"will fail\", () =\u003e {\n        assert.equals(4 + 2, 42)\n    })\n})\n```\n\n2. Create a `test/index.html` to run the tests in your browser\n\n```html\n\u003c!DOCTYPE html\u003e\n\u003chtml lang=\"en\"\u003e\n\u003chead\u003e\n    \u003cmeta charset=\"UTF-8\"\u003e\n    \u003ctitle\u003eTests\u003c/title\u003e\n\u003c/head\u003e\n\u003cbody\u003e\n\u003cscript type=\"module\"\u003e\n    import {teevi} from \"./src/teevi.js\"\n    import \"./MyTest.js\"\n    teevi.run()\n\u003c/script\u003e\n\u003c/body\u003e\n\u003c/html\u003e\n```\n\n![bootstrap-input-spinner](https://shaack.com/projekte/assets/img/teevi-test-demo.png?v=1)\n\n## it.only\n\nUse `it.only(condition, testMethod)` to run only these tests in your test module.\n\n## possible assertions\n\n- `assert.fail(message = DEFAULT_MESSAGE)`\n- `assert.true(message = DEFAULT_MESSAGE)`\n- `assert.false(message = DEFAULT_MESSAGE)`\n- `equal(actual, expected, message = DEFAULT_MESSAGE)`\n- `notEqual(actual, notExpected, message = DEFAULT_MESSAGE)`\n- use `reject(message)` from an async `Promise` (see example below)\n\n## Testing async calls\n\nYou can also test async calls, with the use of promises.\n\n```javascript\nit(\"should test async\", () =\u003e {\n    return new Promise((resolve) =\u003e {\n        setTimeout(() =\u003e {\n            // `resolve`, if test succeeds\n            resolve()\n        }, 500)\n    })\n})\nit(\"should fail async\", () =\u003e {\n    return new Promise((resolve, reject) =\u003e {\n        setTimeout(() =\u003e {\n            // in Promises use `reject()`, not `assert`\n            reject(\"failed, because of testing\")\n        }, 500)\n    })\n})\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshaack%2Fteevi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fshaack%2Fteevi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshaack%2Fteevi/lists"}