# fake-express-http

> Fake Express HttpRequest and HttpResponse for unit testing.

Latest version **1.3.1** (published 2019-01-21) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install fake-express-http
pnpm add fake-express-http
yarn add fake-express-http
bun add fake-express-http
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.3.1 |
| Published | 2019-01-21 |
| First published | 2016-02-16 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 30.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Ronald Chen |
| Maintainers | pyrolistical |
| Keywords | fake, express, http |

## Links

- npm: https://www.npmjs.com/package/fake-express-http
- Repository: https://github.com/concept-not-found/fake-express-http
- Issues: https://github.com/concept-not-found/fake-express-http/issues
- npm.io page: https://npm.io/package/fake-express-http

## Dependencies (2)

- [mime](https://npm.io/package/mime.md) 1.4.1
- [verror](https://npm.io/package/verror.md) 1.9.0

## Alternatives

- [pagerjs](https://npm.io/package/pagerjs.md) — 60 weekly downloads
- [whistle.savefor-mock](https://npm.io/package/whistle.savefor-mock.md) — 4 weekly downloads
- [@iris.interactive/keycloak-mock](https://npm.io/package/@iris.interactive/keycloak-mock.md) — 0 weekly downloads
- [@msw/sveltekit](https://npm.io/package/@msw/sveltekit.md) — 0 weekly downloads
- [instagram-graph-test-server](https://npm.io/package/instagram-graph-test-server.md) — 0 weekly downloads

## Recent versions

- 1.3.1 (latest) — 2019-01-21
- 1.3.0 — 2017-03-10
- 1.2.0 — 2016-07-27
- 1.1.0 — 2016-05-30
- 1.0.0 — 2016-02-16

## README

Fake Express HTTP
=================

[![Circle CI](https://circleci.com/gh/concept-not-found/fake-express-http.svg?style=shield)](https://circleci.com/gh/concept-not-found/fake-express-http)

Fake Express HttpRequest and HttpResponse for unit testing.  Supports Express 4, requires Node 4.x or newer.

Supports asynchronous functions by returning a promise from `response.onEnd()`.

Includes fake and real tests using same controllers to ensure fake is accurate.

What is a Fake?
---------------

The real thing is substituted by a fake.  Where as mocks only partially substitute aspects of the real thing.

Fakes ahear to [Liskov substitution principle](https://en.wikipedia.org/wiki/Liskov_substitution_principle).

State of the Art
----------------

The existence of this library is justified, as state of the art libraries are deficient.

* [node-mocks-http](https://github.com/howardabrams/node-mocks-http) (AKA express-mocks-http)
    * Does not support Express 4.
* [mock-express-request](https://github.com/lykmapipo/mock-express-request) + [mock-express-response](https://github.com/lykmapipo/mock-express-response)
    * Unit testing requires both a fake request and response.  Should be a single library.
    * [Node.js Stream API](https://nodejs.org/api/stream.html) callback style events are exposed to allow for asynchronous testing.
    * As a result does not support promises and has a leaky abstraction with a Stream API `finish` event.

---
_Source: https://npm.io/package/fake-express-http · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
