@rockpack/tester is Jest with cool config, add-ons and fully compatible with TS / Babel.
@rockpack/tester includes several recommended modules and a test report generator.
@rockpack/tester this module is part of the Rockpack project. See more details on the official site.
- Installation:
# NPM
npm install @rockpack/tester --save-dev
# YARN
yarn add @rockpack/tester --dev
-
Make tests.js in the root of project
-
Put the code in tests.js
const tests = require('@rockpack/tester');
tests();
- Run the script
node tests.js
or DEV mode
node tests.js --watch
- Create something.spec.js in src folder of the project and write Jest test
Please see "examples" folder - here
If you need override testEnvironment configuration from JSDom (React App) to Node, you should:
-
Create "jest.extend.js" file in the root of the project
-
Put the code inside:
module.exports = {
testEnvironment: 'node',
};