{"id":24807864,"url":"https://github.com/eddienubes/sagetest","last_synced_at":"2026-03-12T09:25:01.325Z","repository":{"id":220721889,"uuid":"752385257","full_name":"eddienubes/sagetest","owner":"eddienubes","description":"🧪 Neat and streamlined library for testing node.js HTTP servers.","archived":false,"fork":false,"pushed_at":"2025-09-29T11:11:55.000Z","size":13000,"stargazers_count":9,"open_issues_count":16,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-09-29T11:24:50.984Z","etag":null,"topics":["express","expressjs","fastify","fetch","http","node","node-fetch","nodejs","sagetest","superagent","supertest","test","testing","undici"],"latest_commit_sha":null,"homepage":"https://eddienubes.github.io/sagetest/","language":"TypeScript","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/eddienubes.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":"2024-02-03T19:20:10.000Z","updated_at":"2025-09-29T09:12:26.000Z","dependencies_parsed_at":"2024-04-15T14:02:14.791Z","dependency_job_id":"17040c46-cff8-4219-940a-a79248f402f9","html_url":"https://github.com/eddienubes/sagetest","commit_stats":null,"previous_names":["eddienubes/sagetest"],"tags_count":9,"template":false,"template_full_name":null,"purl":"pkg:github/eddienubes/sagetest","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eddienubes%2Fsagetest","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eddienubes%2Fsagetest/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eddienubes%2Fsagetest/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eddienubes%2Fsagetest/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/eddienubes","download_url":"https://codeload.github.com/eddienubes/sagetest/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eddienubes%2Fsagetest/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279014521,"owners_count":26085536,"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-13T02:00:06.723Z","response_time":61,"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":["express","expressjs","fastify","fetch","http","node","node-fetch","nodejs","sagetest","superagent","supertest","test","testing","undici"],"created_at":"2025-01-30T09:27:45.288Z","updated_at":"2025-10-13T09:30:48.657Z","avatar_url":"https://github.com/eddienubes.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n    \u003cimg src=\"misc/logo.png\"\u003e\n\u003c/p\u003e\n\u003chr\u003e\n\u003cp align=\"center\"\u003e\n    Neat and streamlined testing library for node.js HTTP servers powered by \u003ca href=\"https://github.com/nodejs/undici\"\u003e\u003cstrong\u003eundici\u003c/strong\u003e\u003c/a\u003e.\n\u003cp\u003e\n\u003cp align=\"center\"\u003e\n    It's currently in alpha. Everything could be a breaking change until the first major version.\n\u003cp\u003e\n\u003cp align=\"center\"\u003e\n \u003ca href=\"https://eddienubes.github.io/sagetest/\"\u003eDocumentation\u003c/a\u003e | \u003ca href=\"https://eddienubes.github.io/sagetest/getting-started/introduction/\"\u003eGetting Started\u003c/a\u003e\n\u003c/p\u003e\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://www.npmjs.com/package/sagetest\"\u003e\u003cimg src=\"https://img.shields.io/npm/v/sagetest?color=729B1B\u0026label=npm\"/\u003e\u003c/a\u003e\n  \u003ca href=\"https://github.com/eddienubes/sagetest/actions/workflows/ci.yml\"\u003e\u003cimg src=\"https://github.com/eddienubes/sagetest/actions/workflows/ci.yml/badge.svg?branch=main\"/\u003e\u003c/a\u003e\n  \u003ca href=\"https://codecov.io/gh/eddienubes/sagetest\" \u003e\u003cimg src=\"https://codecov.io/gh/eddienubes/sagetest/graph/badge.svg?token=UFSWU4BEEB\"/\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n## 🌟 Features\n\n- Yes! This is a reference to my favourite Valorant character, Sage.\n- **TypeScript friendly**, exposes both ESM and CJS modules.\n- Built on top of [undici](https://github.com/nodejs/undici) for **maximum performance**.\n- Provides **easy-to-use**, supertest-like API.\n- Supports a **dedicated test server** to reduce the number of instances spawned during testing.\n- Supports **Node.js v18.0 and above**.\n- **No unnecessary** third-party dependencies.\n- Automatically handles **cookie parsing**.\n\n## 🚀 Getting Started\n\n```sh\nnpm install -D sagetest\nyarn add -D sagetest\npnpm add -D sagetest\n```\n\n## 🎬 Sagetest in action\n\n\u003e There are several other methods which you can find in the [API documentation](https://eddienubes.github.io/sagetest/).\n\u003e In general, the usage experience should resemble that of supertest.\n\n#### Express Endpoint Testing\n\nExample usage of **auth** method to set Basic Auth header based on username and password.\n\n```ts\nimport { request } from '../src/index.js';\n\n// Just a plain express app\nconst response = await request(app).get('/').auth('user', 'pass');\n\nexpect(response).toEqual({\n  body: {\n    message: 'I love my mom!',\n    requestHeaders: {\n      authorization: 'Basic dXNlcjpwYXNz',\n      connection: 'close',\n      host: expect.stringContaining('localhost')\n    }\n  },\n  cookies: {\n    'sweet-cookie': {\n      httpOnly: true,\n      path: '/',\n      value: 'choco'\n    }\n  },\n  error: false,\n  headers: {\n    connection: 'close',\n    'content-length': '130',\n    'content-type': 'application/json; charset=utf-8',\n    date: expect.any(String),\n    etag: expect.any(String),\n    'set-cookie': 'sweet-cookie=choco; Path=/; HttpOnly',\n    'x-powered-by': 'Express'\n  },\n  location: undefined,\n  ok: true,\n  redirect: false,\n  status: 200,\n  statusCode: 200,\n  statusText: 'OK',\n  text: expect.any(String) // Stringified body\n});\n```\n\n#### Fastify Endpoint Testing\n\nExample usage of **auth** method to set the Authorization header based on the provided token.\nAlso, in response, you're able to validate cookies sent by the server.\n\n```ts\nimport { request } from '../src/index.js';\n\n// Don't forget to wait until all plugins are registered.\nawait fastifyApp.ready();\n\n// Don't forget to use .server instead of plain fastify instance.\nconst response = await request(fastifyApp.server).get('/').auth('jwtToken');\n\nexpect(response).toEqual({\n  body: {\n    message: 'I love my mom!',\n    requestHeaders: {\n      authorization: 'Bearer jwtToken',\n      connection: 'close',\n      host: expect.any(String)\n    }\n  },\n  cookies: {\n    'sweet-cookie': {\n      httpOnly: true,\n      path: '/',\n      value: 'choco'\n    }\n  },\n  error: false,\n  headers: {\n    connection: 'close',\n    'content-length': '127',\n    'content-type': 'application/json; charset=utf-8',\n    date: expect.any(String),\n    'set-cookie': 'sweet-cookie=choco; HttpOnly'\n  },\n  location: undefined,\n  ok: true,\n  redirect: false,\n  status: 200,\n  statusCode: 200,\n  statusText: 'OK',\n  text: expect.any(String) // Stringified body\n});\n```\n\n## 📚 API Documentation\n\nThe API documentation is available [here](https://eddienubes.github.io/sagetest/).\nIf you need more examples or have some questions, just open an issue or submit a pull request.\nI'll be happy to help you out.\n\n## ❤️ Contributing\n\nIf you wish to contribute to the evolution of this package,\nplease feel free to submit your issues or open pull requests.\nYou are always welcome.\n🥰\n\n## License\n\nMIT (c) Eddie Nubes\n\n\n\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feddienubes%2Fsagetest","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Feddienubes%2Fsagetest","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feddienubes%2Fsagetest/lists"}