{"id":21758736,"url":"https://github.com/jupegarnica/tepi","last_synced_at":"2025-04-13T12:20:39.363Z","repository":{"id":62422810,"uuid":"545426377","full_name":"jupegarnica/tepi","owner":"jupegarnica","description":"A .http Test Runner","archived":false,"fork":false,"pushed_at":"2024-11-22T08:30:07.000Z","size":5985,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-11T16:56:58.890Z","etag":null,"topics":["api-rest","api-testing","end-to-end-testing","end2end-testing","http-client","test-automation","test-end-to-end","test-endpoint","test-runner","testing"],"latest_commit_sha":null,"homepage":"https://deno.land/x/tepi","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/jupegarnica.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":"ROADMAP.md","authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-10-04T10:54:13.000Z","updated_at":"2024-12-22T17:26:42.000Z","dependencies_parsed_at":"2024-05-22T07:38:45.067Z","dependency_job_id":"d15a14f8-a52f-41fc-9a78-09dc5b56ccd8","html_url":"https://github.com/jupegarnica/tepi","commit_stats":null,"previous_names":[],"tags_count":75,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jupegarnica%2Ftepi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jupegarnica%2Ftepi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jupegarnica%2Ftepi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jupegarnica%2Ftepi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jupegarnica","download_url":"https://codeload.github.com/jupegarnica/tepi/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248711090,"owners_count":21149292,"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":["api-rest","api-testing","end-to-end-testing","end2end-testing","http-client","test-automation","test-end-to-end","test-endpoint","test-runner","testing"],"created_at":"2024-11-26T11:23:35.978Z","updated_at":"2025-04-13T12:20:39.337Z","avatar_url":"https://github.com/jupegarnica.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# TEPI\n### -- HTTP Test Runner --\n\nhttps://tepi.deno.dev\n\n**Tepi is a test runner for .http files.**\n\nWrite your tests in .http files and run them with `tepi`.\n\n```bash\n\n$ cat test.http\n\nGET http://localhost:3000  # fetch a GET Request\n\nHTTP/1.1 200 OK # assert a 200 OK response\nContent-Type: text/plain # assert a text/plain content type header\n\nHola mundo! # assert a body with the text \"Hola mundo!\"\n```\n\n```bash\n$ tepi test.http\n```\nTest your HTTP APIs with standard http syntax\n\n## Demo:\n\n![Example demo](./vhs/demo.gif)\n\n\n## Features:\n\n- 📝  Write end to end API REST tests in `.http` files\n- 🔎  Validate Response status, headers and/or body.\n- 🔥  Interpolate javascript with [eta](http://eta.js.org/) template `\u003c%= %\u003e` eta url:\n- 🖊   Write metadata as frontmatter yaml\n- 📦  Reference by id another test to run them in advance\n- ⏱   Set a timeout for each test or globally in milliseconds. After the timeout, the test will fail.\n- 🚨  Stop running tests after the first failure.\n- 🔋  Use env files to load environment variables\n- 😎  Fully featured and colorful display modes. (none, minimal, default and full)\n- 👁   Watch files for changes and rerun tests.\n- 🍯  Standard Response and Request with a automatic getBody()\n\n## Install:\n\n\n```bash\ndeno install --global --reload  --allow-read --allow-env --allow-net --allow-run -f -n tepi https://tepi.deno.dev/src/cli.ts\n```\n\nOr run remotely with:\n\n```bash\ndeno run --allow-read --allow-env --allow-net --allow-run https://tepi.deno.dev/src/cli.ts\n```\n\n### Permissions:\n\n* `--allow-read`  Needed to read files from the file system.\n* `--allow-net`   Needed to make HTTP requests.\n* `--allow-env`   (optional) Needed to load and read environment variables. Required if you use the --env-file option.\n* `--allow-run`   (optional) Required if you use the --upgrade option.\n\n## Usage:\n\ntepi [OPTIONS] [FILES|GLOBS...]\n\n### Options:\n\n* `-w` `--watch`           Watch files for changes and rerun tests.\n* `  ` `--watch-no-clear`  same but without clearing the screen.\n* `-t` `--timeout`         Set the timeout for each test in milliseconds. After the timeout, the test will fail.\n* `-f` `--fail-fast`       Stop running tests after the first failure.\n* `-d` `--display`         Set the display mode. (none, minimal, default, truncate, full and verbose)\n       -  _none_:     display nothing\n       -  _minimal_:  display only a minimal summary\n       -  _default_:  list results and full error summary\n       -  _truncate_: list results and full error summary but truncate data\n       -  _full_:     display also all HTTP requests and responses and not truncate data\n       -  _verbose_:  display also all metadata\n* `-e` `--env-file`       load environment variables from a .env file\n* `    --no-color`       output without color\n* `    --no-animation`   output without terminal animations\n* `    --upgrade`        upgrade to the latest version\n* `    --version`        output the version number\n* `-h` `--help`           output help minimal information\n* `-r` `--readme`         output usage full information\n\n### Examples:\n\n`tepi`\n\u003e Run all .http in the current directory and folders. (same as tepi ./**/*.http)\n\n`tepi test.http ./test2.http`\n\u003e Run test.http and test2.http\n\n`tepi **/*.http`\n\u003e Run all .http in the current directory and folders.\n\n`tepi rest.http --watch`\n\u003e Run rest.http and rerun when it changes\n\n`tepi rest.http  --watch \"src/**/*.ts\"`\n\u003e Run rest.http and rerun when any .ts file in the src folder changes.\n\n`tepi rest.http  --watch \"src/**/*.json\" --watch \"src/**/*.ts\"`\n\u003e You can use multiple --watch flags.\n\u003e Note: You can use globs here too, but use quotes to avoid the shell expanding them.\n\n`tepi --timeout 10000`\n\u003e Set the timeout for each test in milliseconds. After the timeout, the test will fail.\n\n`tepi --fail-fast`\n\u003e Stop running tests after the first failure.\n\n`tepi --display minimal`\n\u003e Set the display mode. (none, minimal, default and full)\n\n`tepi --env-file .env --env-file .env.test`\n\u003e Load environment variables from a .env and .env.test\n\n## HTTP syntax:\n\n* You can use the standard HTTP syntax in your .http files to run a request and response validation.\n* Use the `###` to separate the requests.\n* Use `#` to comment.\n* Use front matter yaml to set metadata.\n\nFor example, validate the headers, status code, status text and body:\n\n```http\nGET https://faker.deno.dev/?body=hola\u0026status=400\n\nHTTP/1.1 400 Bad Request\ncontent-type: text/plain; charset=utf-8\n\nhola\n\n```\n\n## Interpolation:\n\nIt's deno 🔥\n\nUses eta as template engine, see docs:\nhttps://deno.land/x/eta\n\nUse `\u003c%= %\u003e` to interpolate values.\n\nAll the std assertion module is available:\nhttps://deno.land/std/testing/asserts.ts\n\n\nUse `\u003c% %\u003e` to run custom assertions or custom JS.\nFor example:\n\n```\nGET  http://localhost:3000/users\n\n\u003c% assert(response.status === 200) %\u003e\n\n```\nOr:\n```\n\u003c% if (Math.random() \u003e 0.5) { %\u003e\n    GET  http://localhost:3000/users/1\n\u003c% } else { %\u003e\n    GET  http://localhost:3000/users/2\n\u003c% } %\u003e\n\n```\n\n### Interpolation scope:\n\nIn the Interpolation `\u003c%= %\u003e` or `\u003c% %\u003e` you have access to any Deno API and the following variables:\n* request: The Request from the actual block.\n* meta: The metadata from the actual block.\n* response: The standard Response object from the fetch API from the actual request. (only available in the expected response, after the request)\n* body: The extracted body an alias of `await response.getBody()` (only available in the expected response, after the request)\n* [id]: the id of a block already run for example: `\u003c%= login.body.jwt %\u003e` or `\u003c%= login.response.status %\u003e`\n\nThe Block signature is:\n\n```ts\ntype Block = {\nmeta: {\n  [key: string]: any,\n},\nrequest?: Request,\nresponse?: Response,\nexpectedResponse?: Response,\nerror?: Error,\nbody?: any,\n}\n```\n\nThe request, response and expectedResponse has a custom method `async getBody()` to extract the body as json, text or blob depending on the content-type.\n\nThe `body` is an alias for `await response.getBody()`.\n\nFor example:\n\n```\n\n---\nid: hello\n---\nGET https://faker.deno.dev/?body=hola\n\nHTTP/1.1 200\n\nhola\n\n###\nPOST https://faker.deno.dev/\n\n\u003c%= hello.body %\u003e\n\nHTTP/1.1 200 OK\n\nhola\n\n```\n\n## Front matter, Adding Metadata:\n\nYou can add metadata to your tests using front matter yaml.\n\nFor example:\n\n```\n---\nid: hello\ndescription: This is a test\nneeds: login\n---\n\nGET https://faker.deno.dev/?body=hola\n```\n\nThis metadata is available in the interpolation scope as `meta` and in the `meta` property of the block.\n\n### Global metadata:\n\nYou can set global metadata in the first block of the file. This metadata will be available in all the blocks. This apllies to all the properties except `meta.id` and `meta.description`, `meta.ignore` and `meta.only`.\n\nFor example:\n\n```http\n---\ndisplay: verbose\ntimeout: 1000\nhost: https://example.com\n---\n###\n\nGET /  # this request will have the host https://example.com and will display the verbose output and will timeout in 1000ms.\n\n\n###\n\nPOST /  # This too\n```\n\n\n\n\n\n### Special metadata keys:\n\nThere are some especial metadata keys used by tepi, as:  meta.needs, meta.id, meta.description, meta.display, meta.timeout and meta.import\n\n#### meta.delay:\nThe meta.delay allows you to delay the execution of the request fetch for a specific time in milliseconds.\n\n#### meta.timeout:\nThe meta.timeout allows you to override the global timeout for a specific test.\nIf the request takes longer than the timeout, the test will fail.\nThe delay is not included in the timeout.\n\n\n#### meta.needs\n\nThe meta.needs is a special metadata value that allows you to run a test in advance and use the result in the current test if needed.\n\nFor example:\n\n```\n---\nneeds: login\n# will run the login test before this one\n---\nGET https://example.com/onlyAdmin\nAuthorization: Bearer \u003c%= login.body.jwt %\u003e\nContent-Type: application/json\n\n###\n---\nid: login\n---\nPOST https://example.com/login\nContent-Type: application/json\n\n{\"user\": \"Garn\", \"password\": \"1234\"}\n\nHTTP/1.1 200 OK\n\n```\n\n#### meta.id and meta.description\n\nThe meta.id allows you to identify a test for reference.\nThe meta.description it's used to display the test name in the console if not set, it will use the meta.id.\n\n#### meta.import:\n\nThe meta.import allows you to import a file before running the test.\nThe imported file will run before the file that imports it.\n\n\n#### meta.display:\n\nThe meta.display allows you to override the global display mode for a specific test.\n\nFor example:\n\n```\n---\ndisplay: verbose\n---\nGET https://example.com/get\n\n```\n\n\n\n\n## VScode extension\n\nYou can use the vscode extension to run the tests from the editor.\n\nJust install the extension and open a .http file and click the hover button to run the test.\n\nhttps://marketplace.visualstudio.com/items?itemName=jupegarnica.tepi","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjupegarnica%2Ftepi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjupegarnica%2Ftepi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjupegarnica%2Ftepi/lists"}