# visionmedia/supertest

**Attribution required: if you use, quote, or summarise this content, you must credit and link back to [awesome-repositories.com](https://awesome-repositories.com/repository/visionmedia-supertest).**

14,365 stars · 783 forks · JavaScript · MIT

## Links

- GitHub: https://github.com/visionmedia/supertest
- awesome-repositories: https://awesome-repositories.com/repository/visionmedia-supertest.md

## Description

Supertest is a Node.js HTTP testing library that provides a framework for making requests and asserting responses from web servers. It functions as an HTTP assertion framework designed to verify status codes, response bodies, and headers during automated server tests.

The library features an ephemeral port server manager that automatically binds servers to random available ports, removing the need for manual port tracking and preventing conflicts during concurrent test execution. It also includes an HTTP session state manager to persist cookies and session data across multiple sequential requests.

Its capabilities cover REST API validation and automated server integration through a fluent interface. The tool supports the verification of cookie state and the persistence of user sessions across a single host.

## Tags

### Testing & Quality Assurance

- [Node.js Test Automation](https://awesome-repositories.com/f/testing-quality-assurance/node-js-test-automation.md) — Provides a specialized framework for automating HTTP tests for web servers within the Node.js runtime.
- [HTTP Response Assertions](https://awesome-repositories.com/f/testing-quality-assurance/general-testing-utilities/test-utilities-assertions/network-api-mocking/http-response-assertions.md) — Provides a fluent mechanism to verify HTTP response properties like status codes and bodies.
- [Server Integration Testing](https://awesome-repositories.com/f/testing-quality-assurance/node-js-test-automation/server-integration-testing.md) — Tests Node.js servers using ephemeral ports to avoid manual port management and conflicts.
- [Request Interceptors](https://awesome-repositories.com/f/testing-quality-assurance/http-request-clients/request-interceptors.md) — Wraps an HTTP client to intercept requests and pipe them directly into a running Node.js server instance.
- [In-Process Server Testing](https://awesome-repositories.com/f/testing-quality-assurance/in-process-server-testing.md) — Allows running the target server within the same Node.js process as the test runner for direct access to internals.
- [Test Server Orchestration](https://awesome-repositories.com/f/testing-quality-assurance/testing-infrastructure-management/test-orchestration/test-setup-orchestrators/test-lifecycle-hooks/test-server-orchestration.md) — Automatically binds servers to ephemeral ports to eliminate manual port tracking during test execution. ([source](https://github.com/visionmedia/supertest#readme))

### Networking & Communication

- [Dynamic Port Listeners](https://awesome-repositories.com/f/networking-communication/network-port-configuration/port-sharing-mechanisms/dynamic-port-listeners.md) — Automatically binds servers to random available ports to prevent conflicts during concurrent test execution.

### Security & Cryptography

- [Session & Cookie Handlers](https://awesome-repositories.com/f/security-cryptography/session-cookie-handlers.md) — Maintains user session state by storing and re-injecting cookies across sequential HTTP requests.
- [Stateful Session Persistence](https://awesome-repositories.com/f/security-cryptography/identity-access-management/session-management/stateful-session-persistence.md) — Maintains browser context and authentication state via cookies across multi-step web interactions. ([source](https://github.com/visionmedia/supertest#readme))
- [HTTP Session Persisters](https://awesome-repositories.com/f/security-cryptography/identity-access-management/session-management/stateful-session-persistence/agentic-session-persistence/interaction-session-persisters/http-session-persisters.md) — Persists cookies and session data across multiple requests to simulate continuous user sessions.
- [Session State Validation](https://awesome-repositories.com/f/security-cryptography/web-session-management/session-state-validation.md) — Verifies that web servers correctly handle cookies and maintain user session state across sequential requests.

### Web Development

- [API Response Validation](https://awesome-repositories.com/f/web-development/rest-apis/api-response-validation.md) — Checks that HTTP server responses meet specific requirements for headers, body content, and status codes.

### Software Engineering & Architecture

- [Fluent Interfaces](https://awesome-repositories.com/f/software-engineering-architecture/fluent-interfaces.md) — Implements a fluent interface for chaining HTTP requests and assertions in a readable manner.

### Part of an Awesome List

- [Testing Frameworks](https://awesome-repositories.com/f/awesome-lists/devtools/testing-frameworks.md) — HTTP server testing library.
