npm package: @putzisan/jest-test
Description: Jest is translated via [babel-jest](https://github.com/facebook/jest/tree/master/packages/babel-jest) via babel to es5 and made usable, for special babel settings see [babels `test`-specific options](#test-specific-options) (`NODE_ENV` to `test` is set by
Author: PS
Latest version: 0.0.5

# Jest with enzyme

Jest is translated via [babel-jest](https://github.com/facebook/jest/tree/master/packages/babel-jest) via babel to es5 and made usable, for special babel settings see [babels `test`-specific options](#test-specific-options) (`NODE_ENV` to `test` is set by jest).

## ToDo

- dokumentieren, warum wie babel mittels rpeprocessor eingebaut ist (lösung von https://github.com/facebook/jest/issues/1468) + check https://github.com/facebook/jest/issues/3845
- setup-tests.js mit require anstatt import geschrieben damit es default mäßig looft

### `jest.config.js`

| config                       | description                                                                                                                      |
| ---------------------------- | -------------------------------------------------------------------------------------------------------------------------------- |
| setupTestFrameworkScriptFile | `dev/setupTests.js` configures [jest-enzyme](#jest-enzyme)                                                                       |
| testRegex                    | all tests have to lay inside `tests`                                                                                             |
| moduleFileExtensions         | test these extensions for `import` or `require`, corresponds to `resolve.extensions` in `webpack.config.js`                      |
| moduleNameMapper             | mock static assets (img, CSS) see [jest-doku - Handling Static Assets](https://jestjs.io/docs/en/webpack#handling-static-assets) |
| transform                    | pass every file through babel                                                                                                    |

### jest-enzyme

[jest-enzyme](https://github.com/FormidableLabs/enzyme-matchers/tree/master/packages/jest-enzyme) by AirBnB is integrated via `dev/setupTests.js`, which is linked to jest in `setupTestFrameworkScriptFile` (see [`jest.config.js`](#jest-config-js)).

jest-enzyme adds more `matcher` functions for jests [`expect`](https://jestjs.io/docs/en/expect). For an overview of these functions, see [enzyme-docu for enzyme-matchers](https://github.com/FormidableLabs/enzyme-matchers).

### jest-dependencies

| package                                                                                               | description                                                                                                                     |
| ----------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------- |
| [jest](https://github.com/facebook/jest)                                                              | test-module for js/react by facebook                                                                                            |
| [jest-enzyme](https://github.com/FormidableLabs/enzyme-matchers/tree/master/packages/jest-enzyme)     | adds [enzyme-matchers](https://github.com/FormidableLabs/enzyme-matchers) to jests [`expect`](https://jestjs.io/docs/en/expect) |
| [enzyme](https://github.com/airbnb/enzyme)                                                            | Test-utils for rendering and mounting React-Components                                                                          |
| [enzyme-adapter-react-16](https://github.com/airbnb/enzyme/blob/master/docs/installation/react-16.md) | adapter for enzyme that it can mount and shallow-render React-16-Components                                                     |