@putzisan/jest-test
v0.0.5
Published
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
Downloads
9
Readme
Jest with enzyme
Jest is translated via babel-jest via babel to es5 and made usable, for special babel settings see babels 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 |
| 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 |
| transform | pass every file through babel |
jest-enzyme
jest-enzyme by AirBnB is integrated via dev/setupTests.js
, which is linked to jest in setupTestFrameworkScriptFile
(see jest.config.js
).
jest-enzyme adds more matcher
functions for jests expect
. For an overview of these functions, see enzyme-docu for enzyme-matchers.
jest-dependencies
| package | description |
| ----------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------- |
| jest | test-module for js/react by facebook |
| jest-enzyme | adds enzyme-matchers to jests expect
|
| enzyme | Test-utils for rendering and mounting React-Components |
| enzyme-adapter-react-16 | adapter for enzyme that it can mount and shallow-render React-16-Components |