https://github.com/deno-libs/superfetch
🐕 HTTP Server testing library inspired by node-supertest-fetch.
https://github.com/deno-libs/superfetch
deno http-testing superagent supertest testing unit-testing
Last synced: about 1 month ago
JSON representation
🐕 HTTP Server testing library inspired by node-supertest-fetch.
- Host: GitHub
- URL: https://github.com/deno-libs/superfetch
- Owner: deno-libs
- License: mit
- Created: 2021-05-23T20:42:56.000Z (almost 4 years ago)
- Default Branch: master
- Last Pushed: 2025-02-06T15:50:08.000Z (3 months ago)
- Last Synced: 2025-03-21T00:51:09.391Z (about 2 months ago)
- Topics: deno, http-testing, superagent, supertest, testing, unit-testing
- Language: TypeScript
- Homepage: https://deno.land/x/superfetch
- Size: 93.8 KB
- Stars: 18
- Watchers: 2
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# superfetch
[![GitHub Workflow Status][gh-actions-img]][github-actions]
[![Codecov][cov-badge]][cov] [![][docs-badge]][docs]HTTP Server testing library inspired by
[node-supertest-fetch](https://github.com/jwalton/node-supertest-fetch).## Example
### Basic testing
```ts
import { describe, it } from 'jsr:@std/testing/bdd'
import { makeFetch } from 'jsr:@deno-libs/superfetch'describe('makeFetch', () => {
it('should work with HTTP handler', async () => {
const handler = (res) => new Response('Hello World')const fetch = makeFetch(s)
const res = await fetch('/')
res.expect('Hello World')
})run()
```### Full access to Response and port
```ts
import { describe, it } from 'jsr:@std/testing/bdd'
import { makeFetch } from 'jsr:@deno-libs/superfetch'describe('makeFetch', () => {
it('should work with HTTP handler', async () => {
const handler = (res) => new Response('Hello World')const fetch = makeFetch(s)
const res = await fetch('/')
res.expect('Hello World')
console.log(res) // server response object
console.log(res.port) // port on which the server was listening
})run()
```[gh-actions-img]: https://img.shields.io/github/actions/workflow/status/deno-libs/superfetch/main.yml?branch=master&style=for-the-badge&logo=github
[cov]: https://coveralls.io/github/deno-libs/superfetch
[github-actions]: https://github.com/deno-libs/superfetch/actions
[cov-badge]: https://img.shields.io/coverallsCoverage/github/deno-libs/superfetch?style=for-the-badge
[docs-badge]: https://img.shields.io/github/v/release/deno-libs/superfetch?color=yellow&label=Docs&logo=deno&style=for-the-badge
[docs]: https://doc.deno.land/https/deno.land/x/superfetch/mod.ts