@putzisan/jest-test

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).

Usage no npm install needed!

<script type="module">
  import putzisanJestTest from 'https://cdn.skypack.dev/@putzisan/jest-test';
</script>

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

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