# zipper-jest-elasticsearch

> Run your tests using jest & elasticsearch-local

Latest version **1.0.6** (published 2021-06-23) · MIT license · 0 weekly downloads

## Install

```sh
npm install zipper-jest-elasticsearch
pnpm add zipper-jest-elasticsearch
yarn add zipper-jest-elasticsearch
bun add zipper-jest-elasticsearch
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 1.0.6 |
| Published | 2021-06-23 |
| First published | 2021-03-19 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=12 |
| Dependencies | 2 |
| Unpacked size | 4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 9 |
| Author | Andrii Petlovanyi |
| Maintainers | maveco69 |
| Keywords | jest, jest environment, jest preset, elasticsearch, elasticsearch local, elasticsearch-local |

## Links

- npm: https://www.npmjs.com/package/zipper-jest-elasticsearch
- Repository: https://github.com/shelfio/jest-elasticsearch
- Homepage: https://github.com/shelfio/jest-elasticsearch#readme
- Issues: https://github.com/shelfio/jest-elasticsearch/issues
- npm.io page: https://npm.io/package/zipper-jest-elasticsearch

## Dependencies (2)

- [cwd](https://npm.io/package/cwd.md) 0.10.0
- [zipper-elasticsearch-local](https://npm.io/package/zipper-elasticsearch-local.md) ^1.0.3

## Alternatives

- [replicas-cli](https://npm.io/package/replicas-cli.md) — 3.0K weekly downloads
- [env-contract](https://npm.io/package/env-contract.md) — 133 weekly downloads
- [@openveo/api](https://npm.io/package/@openveo/api.md) — 61 weekly downloads
- [@ryniaubenpm2/cumque-error-reiciendis](https://npm.io/package/@ryniaubenpm2/cumque-error-reiciendis.md) — 54 weekly downloads
- [ts-global-type-extra](https://npm.io/package/ts-global-type-extra.md) — 11 weekly downloads

## Recent versions

- 1.0.6 (latest) — 2021-06-23
- 1.0.4 — 2021-04-05
- 1.0.3 — 2021-04-05
- 1.0.2 — 2021-03-19
- 1.0.1 — 2021-03-19
- 1.0.0 — 2021-03-19

## README

# jest-elasticsearch

> Jest preset for running tests with local ElasticSearch

## Usage

### 0. Install

```
$ yarn add @shelf/jest-elasticsearch --dev
```

### 1. Create `jest.config.js`

```js
module.exports = {
  preset: '@shelf/jest-elasticsearch'
};
```

If you have a custom `jest.config.js` make sure you remove `testEnvironment` property, otherwise it will conflict with the preset.

### 2. Create `jest-es-config.js`

```js
module.exports = () => {
  return {
    esVersion: '7.6.0', // ! must be exact version. Ref: https://github.com/elastic/elasticsearch-js .
    // don't be shy to fork our code and update deps to correct.
    clusterName: 'your-cluster-name',
    nodeName: 'your-node-name',
    port: 9200,
    indexes: [
      {
        name: 'your-index-name',
        body: {
          settings: {
            number_of_shards: '1',
            number_of_replicas: '1'
          },
          aliases: {
            'your-alias': {}
          },
          mappings: {
            dynamic: false,
            properties: {
              //here you should paste your mapping
              //Example:
              id: {
                type: 'keyword'
              }
            }
          }
        }
      }
    ]
  };
};
```

### 4. PROFIT! Write tests

```js
it();
```

## See Also

- [jest-dynamodb](https://github.com/shelfio/jest-dynamodb)
- [jest-mongodb](https://github.com/shelfio/jest-mongodb)

````

## Publish

```sh
$ git checkout master
$ yarn version
$ yarn publish
$ git push origin master
````

## License

MIT © [Shelf](https://shelf.io)

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