0.0.3 • Published 2 years ago

react-testing-library-shallow v0.0.3

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

React Testing Library Shallow

This library implements shallow rendering for React Testing Library.

Work in progress! This library is currently optimized only for Jest with @swc/jest used for the code transpilation.

Setup

Following configuration of @swc/jest is needed.

{
    jsc: {
        transform: {
            react: {
                pragma: '__reactTestingLibraryShallow.createElement',
                runtime: 'classic',
            },
        },
    },
},

Following configuration of jest is needed.

{
    // This setup file entry should be used as early as possible
    setupFiles: ['react-testing-library-shallow/lib/setup.js'],
}

Usage

import shallow from 'react-testing-library-shallow';
import MyComponent from './MyComponent';

describe('MyComponent', () => {
    test('can be shallow rendered', () => {
        expect(shallow(<MyComponent value={1} />)).toMatchSnapshot();
    });
});
0.0.3

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago