{"id":21223917,"url":"https://github.com/niklauslee/micro-jest","last_synced_at":"2026-05-17T13:36:02.491Z","repository":{"id":77037126,"uuid":"470090610","full_name":"niklauslee/micro-jest","owner":"niklauslee","description":"A tiny testing framework for Kaluma","archived":false,"fork":false,"pushed_at":"2022-03-15T10:24:20.000Z","size":33,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-01-21T17:30:44.797Z","etag":null,"topics":["jest","kaluma","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/niklauslee.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":"2022-03-15T09:36:15.000Z","updated_at":"2022-03-15T10:10:18.000Z","dependencies_parsed_at":null,"dependency_job_id":"216ce7d1-65a2-4429-b9d9-9b67995f6ede","html_url":"https://github.com/niklauslee/micro-jest","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/niklauslee%2Fmicro-jest","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/niklauslee%2Fmicro-jest/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/niklauslee%2Fmicro-jest/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/niklauslee%2Fmicro-jest/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/niklauslee","download_url":"https://codeload.github.com/niklauslee/micro-jest/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243671781,"owners_count":20328694,"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":["jest","kaluma","testing"],"created_at":"2024-11-20T22:54:01.908Z","updated_at":"2026-05-17T13:35:57.451Z","avatar_url":"https://github.com/niklauslee.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Overview\n\n**Micro-Jest** is a tiny JavaScript testing framework for [Kaluma](https://kalumajs.org/). It is distilled version of the original [Jest](https://jestjs.io/) project.\n\n# Install\n\nInstall package with NPM.\n\n```bash\n$ npm install https://github.com/niklauslee/micro-jest --save\n```\n\n# Usage\n\nHere is a simple example. Different from Jest, you have to call `done()` always even if the test case is synchronous.\n\n```js\nconst { test, expect, start } = require(\"micro-jest\");\n\nfunction sum(a, b) {\n  return a + b;\n}\n\ntest(\"adds 1 + 2 to equal 3\", (done) =\u003e {\n  expect(sum(1, 2)).toBe(3);\n  done(); // should be called\n});\n\nstart(); // start to test\n```\n\n# Using Matchers\n\nMicro-Jest provides various matchers to test values. `toBe()` is used to test a value with exact equality.\n\n```js\ntest(\"1 + 1 = 2\", (done) =\u003e {\n  expect(1 + 1).toBe(2);\n  done();\n});\n```\n\nHere is the matchers provided.\n\n- `expect(value).toBe(value)`\n- `expect(value).notToBe(value)`\n- `expect(value).toBeTruthy()`\n- `expect(value).toBeFalsy()`\n- `expect(number).toBeGreaterThan(number)`\n- `expect(number).toBeGreaterThanOrEqual(number)`\n- `expect(number).toBeLessThan(number)`\n- `expect(number).toBeLessThanOrEqual(number)`\n- `expect(array).toContain(value)`\n- `expect(array).notToContain(value)`\n- `expect(string).toMatch(regex)`\n- `expect(string).notToMatch(regex)`\n- `expect(function).toThrow([message])`\n- `expect(function).notToThrow()`\n\n# Running tests\n\nTo run all test cases you have to call `jest.start()`.\n\nHowever sometimes you want to run a particular test case rather than all test cases. You can do it by calling `start()` with a number of test case.\n\n```js\njest.start(0); // Run the first test case.\njest.start(3); // Run the 4-th test case.\njest.start(); // Run all the test cases.\n```\n\n# Handling errors\n\nIf you catch an error you can pass it to `done()` callback.\n\n```js\n// async\ntest('adds 1 + 2 to equal 3', (done) =\u003e {\n  someAsyncFunction(err =\u003e {\n    if (err) {\n      done(err);\n    } else {\n      expect(...).toBe(...);\n      done();\n    }\n  })\n});\n\n// sync\ntest('adds 1 + 2 to equal 3', (done) =\u003e {\n  try {\n    someSyncFunction();\n    done();\n  } catch(err) {\n    done(err);\n  }\n});\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fniklauslee%2Fmicro-jest","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fniklauslee%2Fmicro-jest","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fniklauslee%2Fmicro-jest/lists"}