{"id":15835312,"url":"https://github.com/luuuis/mokapot","last_synced_at":"2026-05-09T00:33:33.335Z","repository":{"id":57301125,"uuid":"332845502","full_name":"luuuis/mokapot","owner":"luuuis","description":"DRY, reusable and composable test resources for Mocha.","archived":false,"fork":false,"pushed_at":"2021-02-15T15:57:55.000Z","size":52,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-10-12T14:34:03.981Z","etag":null,"topics":["fixture","jest","mocha"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/luuuis.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-01-25T18:34:31.000Z","updated_at":"2023-04-28T09:00:13.000Z","dependencies_parsed_at":"2022-08-22T22:31:32.061Z","dependency_job_id":null,"html_url":"https://github.com/luuuis/mokapot","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luuuis%2Fmokapot","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luuuis%2Fmokapot/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luuuis%2Fmokapot/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luuuis%2Fmokapot/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/luuuis","download_url":"https://codeload.github.com/luuuis/mokapot/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246639350,"owners_count":20809988,"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":["fixture","jest","mocha"],"created_at":"2024-10-05T14:22:19.709Z","updated_at":"2026-05-09T00:33:33.277Z","avatar_url":"https://github.com/luuuis.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# mokapot.js\n\n![](https://raw.githubusercontent.com/luuuis/mokapot/master/assets/noun_Moka%20Pot_101129.png)\n\nDRY, reusable and composable test resources for Mocha.\n\n```ecmascript 6\nimport { mokapot} from 'mokapot'\n\n// pair of Promise-returning functions\nconst createServer = (dir) =\u003e mokapot.async(\n  async () =\u003e createServerAsync({ workDir: dir() }), // set up\n  async (server) =\u003e server.closeAsync()              // optional tear down\n)\n\n// async generator\nconst createServerGen = (dir) =\u003e mokapot.gen(async function* () {\n  const server = await createServerAsync({ workDir: dir() })\n  yield server\n  await server.closeAsync()\n})\n\n// pair of sync functions\nconst tmpDir = mokapot.sync(\n  () =\u003e fs.mkdirSync('/tmp/' + Math.random),\n  (dir) =\u003e fs.rmdirSync(dir)\n)\n\n// pair of NodeJS-style functions\nconst anotherTmpDir = mokapot.node(\n  (cb) =\u003e fs.mkdir('/tmp/' + Math.random, cb),\n  (dir, cb) =\u003e fs.rmdir(dir, cb)\n)\n\ndescribe('server test', function () {\n  const tmp = mokapot.before(tmpDir)\n  const server = mokapot.beforeEach(createServer(tmp))\n\n  it('should respond', function () {\n    assert(server() instanceof Server) // get current value\n  });\n});\n```\n\n\u003csub\u003eMoka Pot icon \u003ca href=\"https://thenounproject.com/term/moka-pot/101129/\"\u003ecreated by Marvin Wilhelm for the Noun Project\u003c/a\u003e\u003c/sub\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fluuuis%2Fmokapot","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fluuuis%2Fmokapot","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fluuuis%2Fmokapot/lists"}