{"id":43270548,"url":"https://github.com/treeder/testkit","last_synced_at":"2026-02-01T15:41:28.052Z","repository":{"id":311073070,"uuid":"1042355381","full_name":"treeder/testkit","owner":"treeder","description":"The simplest API testing kit. ","archived":false,"fork":false,"pushed_at":"2025-10-15T19:26:41.000Z","size":112,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-10-16T20:33:23.867Z","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/treeder.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":"2025-08-21T22:15:16.000Z","updated_at":"2025-10-15T19:26:45.000Z","dependencies_parsed_at":"2025-09-12T16:27:33.611Z","dependency_job_id":"3078bbcc-1a0d-4ebd-b215-5678745ed3e2","html_url":"https://github.com/treeder/testkit","commit_stats":null,"previous_names":["treeder/testkit"],"tags_count":19,"template":false,"template_full_name":null,"purl":"pkg:github/treeder/testkit","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/treeder%2Ftestkit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/treeder%2Ftestkit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/treeder%2Ftestkit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/treeder%2Ftestkit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/treeder","download_url":"https://codeload.github.com/treeder/testkit/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/treeder%2Ftestkit/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28981454,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-01T15:35:50.179Z","status":"ssl_error","status_checked_at":"2026-02-01T15:35:38.075Z","response_time":56,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: 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":[],"created_at":"2026-02-01T15:41:27.551Z","updated_at":"2026-02-01T15:41:28.047Z","avatar_url":"https://github.com/treeder.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# testkit\n\nThe simplest API testing kit.\n\n## Motivation\n\nMost testing frameworks are complicated, old, not ESM, etc. I just wanted something super simple that is easy to get started, lets you do anything you want without jumping through hoops, and gets\nout of your way.\n\n## Getting started\n\n```sh\nnpm install --save-dev treeder/testkit\n```\n\nThen write simple tests like this:\n\n```js\nimport { assert } from 'testkit'\n\nexport async function test1(c) {\n  let r = await c.api.fetch(`/`)\n  console.log('r:', r)\n  assert(r.message == 'hello world!', 'not hello world!')\n}\n```\n\nThen add tests to TestKit and run:\n\n```js\nimport { TestKit } from 'testkit'\nimport { test1 } from './test1.js'\n\n// create context:\nlet c = {\n  env: process.env,\n}\n// create TestKit\nlet testKit = new TestKit(c, [test1])\n// run\nawait testKit.run()\n```\n\nSee full example with auth headers and what not that you can copy and paste at [test/test.js](test/test.js)\n\n### Running tests\n\nIn your package.json, make sure you have 3 scripts to run:\n\n- `run` - to run your app.\n- `test:run` - to run your tests, assumes that your app is already running.\n- `test` - this starts testkit which will run app with the `run` command then once it is running, `test:run` will execute to run your tests.\n\n```json\n\"scripts\": {\n  \"run\": \"npx -y wrangler dev\",\n  \"test:run\": \"node tests/tests.js\",\n  \"test\": \"npx -y treeder/testkit --port=8787\",\n},\n```\n\nThen run:\n\n```sh\nnpm test\n```\n\nAdd `npm test` to your CI and if it passes, you're good. If it fails, don't merge!\n\n### Passing data through the tests\n\nTests run in the order you define them in the array you pass to `new TestKit()`.\n\nIf your test returns an object, that object will be merged into the context under a `data` field that you can access in subsequent tests.\n\nTest 1:\n\n```js\nexport async function test1(c) {\n  let myObject = { name: 'john' }\n  return { myObject }\n}\n```\n\nThat return data will be available in any subsequest test.\n\n```js\nexport async function test2(c) {\n  console.log(c.data.myObject)\n}\n```\n\n## To run examples in this repository.\n\nClone the repo and run:\n\n```sh\nnpm run testkit\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftreeder%2Ftestkit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftreeder%2Ftestkit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftreeder%2Ftestkit/lists"}