{"id":15363229,"url":"https://github.com/ron96g/supertest-docs","last_synced_at":"2026-04-20T13:07:45.369Z","repository":{"id":84428483,"uuid":"569371118","full_name":"ron96G/supertest-docs","owner":"ron96G","description":"A plugin for supertest that can be used to document REST APIs. It is influenced by the Spring-Boot solution restdocs.","archived":false,"fork":false,"pushed_at":"2022-11-22T17:15:28.000Z","size":11,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-07-02T13:52:29.180Z","etag":null,"topics":["automation","docs","documentation","markdown","node","restdocs","supertest","unit-testing"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/ron96G.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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-11-22T17:13:32.000Z","updated_at":"2022-11-22T17:32:56.000Z","dependencies_parsed_at":"2023-03-12T22:56:23.949Z","dependency_job_id":null,"html_url":"https://github.com/ron96G/supertest-docs","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/ron96G/supertest-docs","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ron96G%2Fsupertest-docs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ron96G%2Fsupertest-docs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ron96G%2Fsupertest-docs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ron96G%2Fsupertest-docs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ron96G","download_url":"https://codeload.github.com/ron96G/supertest-docs/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ron96G%2Fsupertest-docs/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32048474,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-20T11:35:06.609Z","status":"ssl_error","status_checked_at":"2026-04-20T11:34:48.899Z","response_time":94,"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":["automation","docs","documentation","markdown","node","restdocs","supertest","unit-testing"],"created_at":"2024-10-01T13:05:10.812Z","updated_at":"2026-04-20T13:07:45.354Z","avatar_url":"https://github.com/ron96G.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Supertest Documentation Plugin\n\nA plugin for [supertest](https://github.com/visionmedia/supertest) that can be used to document REST APIs. It is influenced by the Spring-Boot solution [restdocs](https://spring.io/projects/spring-restdocs).\n\nIt uses the request/response from the supertest call in a unit-test to generate snippets.\nThese snippets may then be used to enhance or further generate any documentation.\n\nIt may also be used independently of supertest. This could be useful when documenting events where the API is developed by another team and there is no mock in place (see [here](test/document.test.js#L87)).\n\n## Supported Formats\n\nThe generated snippets are all in a specific output format. The following formats are supported:\n\n### Markdown\n\nWhich could be used with [mkdocs](https://www.mkdocs.org/).\n\n---\n\n## Generated Snippets (Examples)\n\nCurrently the following snippets are generated when using supertest in a unit-test.\nThese were generated using the following unit-test (see [here](test/document.test.js#L38)):\n\n```js\nrequest(url)\n  .post(\"/jsonTest\")\n  // name here defines the output directory\n  .document(\"requestDocument(json)\", { \n    host: \"test.host.com:443\",\n    protocol: \"https\",\n  })\n  .setD(\"Content-Type\", \"application/json\", \"Content-Type must be JSON\")\n  .set(\"Accept\", \"application/json\")\n  .send({ name: \"john\" })\n  .expect({ hello: \"world\" }, done);\n```\n\nAll generated snippets can then be found under `generated-snippets/requestDocument(json)/`.\n\n### Curl Request\n\n```bash\n$ curl 'https://test.host.com/jsonTest' -i -X POST \\\n\t-H 'Content-Type: application/json' \\\n\t-H 'Accept: application/json' \\\n\t-d '{\"name\":\"john\"}'\n```\n\n### HTTP Request\n\n```\nPOST /jsonTest HTTP/1.1\nHost: test.host.com\nAccept-Encoding: gzip, deflate\nContent-Type: application/json\nAccept: application/json\n\n{\n  \"name\": \"john\"\n}\n```\n\n### HTTP Response\n\n```\nStatus-Code: \"200 OK\"\nx-powered-by: Express\ncontent-type: application/json; charset=utf-8\netag: W/\"11-IkjuL6CqqtmReFMfkkvwC0sKj04\"\n\n{\n  \"hello\": \"world\"\n}\n```\n\n### Request Body\n\n```json\n{\n  \"name\": \"john\"\n}\n```\n\n### Request Headers\n\n| Name           | Description               |\n| :------------- | :------------------------ |\n| `Content-Type` | Content-Type must be JSON |\n\n### Response Body\n\n```json\n{\n  \"hello\": \"world\"\n}\n```\n\n### Response Headers\n\nNo relevant information.\n\n---","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fron96g%2Fsupertest-docs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fron96g%2Fsupertest-docs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fron96g%2Fsupertest-docs/lists"}