@rockpack/tester
v8.0.0
Published
Pre-configured Jest setup for React and TypeScript with testing-library and best-practice defaults
Downloads
492
Maintainers
Readme
@rockpack/tester
@rockpack/tester is a pre-configured Jest setup with TypeScript and Babel support, HTML reporting, and best-practice defaults for React projects.
This module is part of the Rockpack project. See more details on the official site.
Included
- Full TypeScript and Babel support via
@rockpack/babel - jest-html-reporters - HTML test report generation
- jsdom environment for React component testing
- CSS module mocking via identity-object-proxy
Using
- Installation:
# NPM
npm install @rockpack/tester --save-dev
# YARN
yarn add @rockpack/tester --dev- Create tests.js in the root of the project:
const tests = require('@rockpack/tester');
tests();- Run tests:
node tests.jsor in watch mode:
node tests.js --watch- Create
something.spec.js(or.spec.ts) in thesrcfolder and write your Jest tests.
See the examples folder - here
Configuration
To override Jest configuration - for example, to switch the test environment from jsdom to Node:
- Create
jest.extend.jsin the root of the project:
module.exports = {
testEnvironment: 'node',
};The MIT License
MIT
