# jest-supertest-cookie-fix

> Fixes an issue with supertest where cookies are not set properly when testing with jest.

Latest version **1.0.0** (published 2018-04-12) · MIT license · 0 weekly downloads

## Install

```sh
npm install jest-supertest-cookie-fix
pnpm add jest-supertest-cookie-fix
yarn add jest-supertest-cookie-fix
bun add jest-supertest-cookie-fix
```

## 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.0.0 |
| Published | 2018-04-12 |
| First published | 2018-04-12 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >= 7.4 |
| Dependencies | 1 |
| Unpacked size | 5.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Christopher Szatmary |
| Maintainers | cszatma |
| Keywords | jest cookie fix, supertest jest cookie, supertest cookie fix, supertest jest cookie fix, cookie fix |

## Links

- npm: https://www.npmjs.com/package/jest-supertest-cookie-fix
- Repository: git@github.com:cszatma/jest-supertest-cookie-fix
- Issues: https://github.com/cszatma/jest-supertest-cookie-fix/issues
- npm.io page: https://npm.io/package/jest-supertest-cookie-fix

## Dependencies (1)

- [supertest](https://npm.io/package/supertest.md) ^3.0.0

## Alternatives

- [duck](https://npm.io/package/duck.md) — 4.2M weekly downloads
- [ava](https://npm.io/package/ava.md) — 560.2K weekly downloads
- [storybook-addon-module-mock](https://npm.io/package/storybook-addon-module-mock.md) — 71.7K weekly downloads
- [@ethereum-waffle/mock-contract](https://npm.io/package/@ethereum-waffle/mock-contract.md) — 40.0K weekly downloads
- [aws-elasticsearch-connector](https://npm.io/package/aws-elasticsearch-connector.md) — 37.4K weekly downloads

## Recent versions

- 1.0.0 (latest) — 2018-04-12

## README

# jest-supertest-cookie-fix

Fixes an issue with supertest where cookies are not set properly when testing with jest.

In reference to issues [supertest#413](https://github.com/visionmedia/supertest/issues/413), [supertest#460](https://github.com/visionmedia/supertest/issues/460) and [jest#3547](https://github.com/facebook/jest/issues/3547). It seems that jest sets the cookies as a single string which then causes issues when the cookies try to get parsed. This library aims to provide a quick and simple solution to this issue.

### Install

Install with `yarn`:

```bash
$ yarn add jest-supertest-cookie-fix --dev
```

Or use `npm` if you wish:

```bash
$ npm install jest-supertest-cookie-fix --save-dev
```

### Usage

The easiest way to use this package is simply to import the fixed agent that is exported.
Then use it normally the way you would use the supertest agent.

```javascript
const agent = require('jest-supertest-cookie-fix');

agent(app).get('/').expect(200);
```

You can also import `fixedSupertestAgent()` and pass it an instance of an agent.

```javascript
const request = require('supertest');
const fixedSupertestAgent = require('jest-supertest-cookie-fix').fixedSupertestAgent;

const agent = request.agent(app);
const fixedAgent = fixedSupertestAgent(agent);
```

### License
jest-supertest-cookie-fix is available under the [MIT License](https://github.com/cszatma/jest-supertest-cookie-fix/tree/master/LICENSE).

### Contributing
Contributions are welcome. Feel free to open an issue or submit a pull request.

---
_Source: https://npm.io/package/jest-supertest-cookie-fix · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
