JavaScript Testing utilities for React

Overview

Enzyme

Join the chat at https://gitter.im/enzymejs/enzyme

npm Version License Build Status Coverage Status

Enzyme is a JavaScript Testing utility for React that makes it easier to test your React Components' output. You can also manipulate, traverse, and in some ways simulate runtime given the output.

Enzyme's API is meant to be intuitive and flexible by mimicking jQuery's API for DOM manipulation and traversal.

Upgrading from Enzyme 2.x or React < 16

Are you here to check whether or not Enzyme is compatible with React 16? Are you currently using Enzyme 2.x? Great! Check out our migration guide for help moving on to Enzyme v3 where React 16 is supported.

Installation

To get started with enzyme, you can simply install it via npm. You will need to install enzyme along with an Adapter corresponding to the version of react (or other UI Component library) you are using. For instance, if you are using enzyme with React 16, you can run:

npm i --save-dev enzyme enzyme-adapter-react-16

Each adapter may have additional peer dependencies which you will need to install as well. For instance, enzyme-adapter-react-16 has peer dependencies on react and react-dom.

At the moment, Enzyme has adapters that provide compatibility with React 16.x, React 15.x, React 0.14.x and React 0.13.x.

The following adapters are officially provided by enzyme, and have the following compatibility with React:

Enzyme Adapter Package React semver compatibility
enzyme-adapter-react-16 ^16.4.0-0
enzyme-adapter-react-16.3 ~16.3.0-0
enzyme-adapter-react-16.2 ~16.2
enzyme-adapter-react-16.1 ~16.0.0-0 || ~16.1
enzyme-adapter-react-15 ^15.5.0
enzyme-adapter-react-15.4 15.0.0-0 - 15.4.x
enzyme-adapter-react-14 ^0.14.0
enzyme-adapter-react-13 ^0.13.0

Finally, you need to configure enzyme to use the adapter you want it to use. To do this, you can use the top level configure(...) API.

import Enzyme from 'enzyme';
import Adapter from 'enzyme-adapter-react-16';

Enzyme.configure({ adapter: new Adapter() });

3rd Party Adapters

It is possible for the community to create additional (non-official) adapters that will make enzyme work with other libraries. If you have made one and it's not included in the list below, feel free to make a PR to this README and add a link to it! The known 3rd party adapters are:

Adapter Package For Library Status
enzyme-adapter-preact-pure preact (stable)
enzyme-adapter-inferno inferno (work in progress)

Running Enzyme Tests

Enzyme is unopinionated regarding which test runner or assertion library you use, and should be compatible with all major test runners and assertion libraries out there. The documentation and examples for enzyme use Mocha and Chai, but you should be able to extrapolate to your framework of choice.

If you are interested in using enzyme with custom assertions and convenience functions for testing your React components, you can consider using:

Using Enzyme with Mocha

Using Enzyme with Karma

Using Enzyme with Browserify

Using Enzyme with SystemJS

Using Enzyme with Webpack

Using Enzyme with JSDOM

Using Enzyme with React Native

Using Enzyme with Jest

Using Enzyme with Lab

Using Enzyme with Tape and AVA

Basic Usage

Shallow Rendering

import React from 'react';
import { expect } from 'chai';
import { shallow } from 'enzyme';
import sinon from 'sinon';

import MyComponent from './MyComponent';
import Foo from './Foo';

describe('<MyComponent />', () => {
  it('renders three <Foo /> components', () => {
    const wrapper = shallow(<MyComponent />);
    expect(wrapper.find(Foo)).to.have.lengthOf(3);
  });

  it('renders an `.icon-star`', () => {
    const wrapper = shallow(<MyComponent />);
    expect(wrapper.find('.icon-star')).to.have.lengthOf(1);
  });

  it('renders children when passed in', () => {
    const wrapper = shallow((
      <MyComponent>
        <div className="unique" />
      </MyComponent>
    ));
    expect(wrapper.contains(<div className="unique" />)).to.equal(true);
  });

  it('simulates click events', () => {
    const onButtonClick = sinon.spy();
    const wrapper = shallow(<Foo onButtonClick={onButtonClick} />);
    wrapper.find('button').simulate('click');
    expect(onButtonClick).to.have.property('callCount', 1);
  });
});

Read the full API Documentation

Full DOM Rendering

import React from 'react';
import sinon from 'sinon';
import { expect } from 'chai';
import { mount } from 'enzyme';

import Foo from './Foo';

describe('<Foo />', () => {
  it('allows us to set props', () => {
    const wrapper = mount(<Foo bar="baz" />);
    expect(wrapper.props().bar).to.equal('baz');
    wrapper.setProps({ bar: 'foo' });
    expect(wrapper.props().bar).to.equal('foo');
  });

  it('simulates click events', () => {
    const onButtonClick = sinon.spy();
    const wrapper = mount((
      <Foo onButtonClick={onButtonClick} />
    ));
    wrapper.find('button').simulate('click');
    expect(onButtonClick).to.have.property('callCount', 1);
  });

  it('calls componentDidMount', () => {
    sinon.spy(Foo.prototype, 'componentDidMount');
    const wrapper = mount(<Foo />);
    expect(Foo.prototype.componentDidMount).to.have.property('callCount', 1);
    Foo.prototype.componentDidMount.restore();
  });
});

Read the full API Documentation

Static Rendered Markup

import React from 'react';
import { expect } from 'chai';
import { render } from 'enzyme';

import Foo from './Foo';

describe('<Foo />', () => {
  it('renders three `.foo-bar`s', () => {
    const wrapper = render(<Foo />);
    expect(wrapper.find('.foo-bar')).to.have.lengthOf(3);
  });

  it('renders the title', () => {
    const wrapper = render(<Foo title="unique" />);
    expect(wrapper.text()).to.contain('unique');
  });
});

Read the full API Documentation

React Hooks support

Enzyme supports react hooks with some limitations in .shallow() due to upstream issues in React's shallow renderer:

  • useEffect() and useLayoutEffect() don't get called in the React shallow renderer. Related issue

  • useCallback() doesn't memoize callback in React shallow renderer. Related issue

ReactTestUtils.act() wrap

If you're using React 16.8+ and .mount(), Enzyme will wrap apis including .simulate(), .setProps(), .setContext(), .invoke() with ReactTestUtils.act() so you don't need to manually wrap it.

A common pattern to trigger handlers with .act() and assert is:

const wrapper = mount(<SomeComponent />);
act(() => wrapper.prop('handler')());
wrapper.update();
expect(/* ... */);

We cannot wrap the result of .prop() (or .props()) with .act() in Enzyme internally since it will break the equality of the returned value. However, you could use .invoke() to simplify the code:

const wrapper = mount(<SomeComponent />);
wrapper.invoke('handler')();
expect(/* ... */);

Future

Enzyme Future

Contributing

See the Contributors Guide

In the wild

Organizations and projects using enzyme can list themselves here.

License

MIT

Comments
  • Add support for react context element types, fixes #1509

    Add support for react context element types, fixes #1509

    There are some outstanding support concerns here with shallow rendered per https://github.com/facebook/react/issues/12152 but i wasn't attempting to fix those here. This just adds support for traversal over said elements. I was not sure how to structure the peer deps in a way that would exercise this test as well...

    cc @aweary

    semver: minor package: react adapter: 16 
    opened by jquense 89
  • Testing a Redux-connected component using Enzyme

    Testing a Redux-connected component using Enzyme

    Enzyme

    i) What is the least error-prone way to test a Redux-connected Componet using Enzyme? I have checked many links and articles but haven't found a satisfactory answer. It's confusing me a lot. ii)How can I test whether my component is getting certain props or not using Enzyme?

    Versions

    • React-Boilerplate : Current Version
    • Node/NPM: ^6
    • Browser: Chrome
    • Enzyme: Current Version
    question 
    opened by mrsaeeddev 80
  • Testing Hooks with shallow: Invariant Violation

    Testing Hooks with shallow: Invariant Violation

    Current behavior

    When testing component which contains newly released React Hooks using shallow, it crashes: Invariant Violation: Hooks can only be called inside the body of a function component.

    Everything works fine at run time or when testing with render:

    My test component:

    import * as React from 'react';
    
    function Test() {
        const [myState, setMyState] = React.useState('Initial state');
    
        const changeState = () => setMyState('State updated');
    
        return (
            <div>
                {myState}
                <button onClick={changeState}>Change</button>
            </div>
        );
    }
    
    export default Test;
    

    My test file:

    import { shallow } from 'enzyme';
    import * as React from 'react';
    import Test from './Test';
    
    it('renders without crashing', () => {
        const comp = shallow(<Test />);
    
        expect(comp.find('Test')).toMatchSnapshot();
    });
    

    Error stack trace:

    Invariant Violation: Hooks can only be called inside the body of a function component.
    
        at invariant (node_modules/react/cjs/react.development.js:125:15)
        at resolveDispatcher (node_modules/react/cjs/react.development.js:1450:28)
        at Object.useState (node_modules/react/cjs/react.development.js:1473:20)
        at Test (src/Test.tsx:4:11)
        at node_modules/enzyme-adapter-react-16/build/ReactSixteenAdapter.js:440:38
        at ReactShallowRenderer.render (node_modules/react-test-renderer/cjs/react-test-renderer-shallow.development.js:412:39)
        at node_modules/enzyme-adapter-react-16/build/ReactSixteenAdapter.js:444:37
        at withSetStateAllowed (node_modules/enzyme-adapter-utils/build/Utils.js:137:16)
        at Object.render (node_modules/enzyme-adapter-react-16/build/ReactSixteenAdapter.js:443:70)
        at new ShallowWrapper (node_modules/enzyme/build/ShallowWrapper.js:206:22)
        at Object.shallow (node_modules/enzyme/build/shallow.js:21:10)
        at Object.<anonymous> (src/Test.test.tsx:6:18)
            at new Promise (<anonymous>)
        at Promise.resolve.then.el (node_modules/p-map/index.js:46:16)
        at process._tickCallback (internal/process/next_tick.js:68:7)
    

    Expected behavior

    Tests should run

    Your environment

    Fresh create-react-app-typescript install with react 16.7.0-alpha-0

    API

    • [x] shallow
    • [ ] mount
    • [ ] render

    Version

    | library | version | ------------------- | ------- | enzyme | 3.8.0 | react | 16.7.0-alpha.0 | react-dom | 16.7.0-alpha.0 | react-test-renderer | | adapter (below) |

    Adapter

    • [x] enzyme-adapter-react-16
    • [ ] enzyme-adapter-react-16.3
    • [ ] enzyme-adapter-react-16.2
    • [ ] enzyme-adapter-react-16.1
    • [ ] enzyme-adapter-react-15
    • [ ] enzyme-adapter-react-15.4
    • [ ] enzyme-adapter-react-14
    • [ ] enzyme-adapter-react-13
    • [ ] enzyme-adapter-react-helper
    • [ ] others ( )
    opened by TdyP 79
  • Support React.lazy and React.Suspense

    Support React.lazy and React.Suspense

    Fixes #1917 .

    Given a component wrapped by React.lazy in <Suspense /> It'll plainly render a <Lazy /> in shallow and render fallback component in mount.

    There are something I'm not sure / still working on:

    1. What should displayName of the component returned by React.lazy be? Currently I directly named it as Lazy. Not sure if it's something we could define by ourselves.

    2. I'm trying to add an waitUntilLazyLoaded() on ReactWrapper, which will return a promise resolving when the dynamic import loaded and React trigger the re-render, so we can write some tests like:

    
    const LazyComponent = lazy(() => import('/path/to/dynamic/component'));
    const Fallback = () => <div />;
    const SuspenseComponent = () => (
        <Suspense fallback={<Fallback />}>
          <LazyComponent />
        </Suspense>
    );
    
    const wrapper = mount(<SuspenseComponent />)
    await wrapper.waitUntilLazyLoaded()
    
    expect(wrapper.find('DynamicComponent').to.have.lengthOf(1)
    
    

    But I don't know how to detect if all the lazy loaded component inside <Suspense /> has completeted loading. It looks like that we have to hack around react fiber. @ljharb Would you know any way to detect this?

    Also note that this PR add babel-plugin-dynamic-import-node and babel-plugin-syntax-dynamic-import for using import(), babel-eslint in enzyme-adapter-react-16 and enzyme-test-suite for dynamic import support of eslint.

    API: shallow API: mount semver: minor package: react adapter: 16 
    opened by chenesan 74
  • Setting text value of input

    Setting text value of input

    To set the value of an input currently I have to do:

    const form = mount(<MyComponent />);
    const input = form.find('input').get(0);
    input.value = 'Blah blah';
    

    It would be really nice in my opinion if I could instead do something akin to jQuery:

    form.find('input').text('Blah blah')
    // or probably better
    form.find('input').value('Blah blah')
    

    What are your thoughts on that? I'd be happy to attempt to work on the PR :)

    enhancement help wanted 
    opened by jackfranklin 74
  • Webpack build issues

    Webpack build issues

    I'm trying to get enzyme working using a pretty standard webpack/karma setup. Webpack throws a bunch of errors related to the dependencies enzyme imports, including sinon, cheerio, and jsdom. Sinon gives webpack heartburn because it uses it's own require (which seems to be documented here: https://github.com/webpack/webpack/issues/304), and then there are a bunch of "Module not found" errors for jsdom and cheerio.

    I'm importing enzyme as described in the docs and can't really think of anything else I might be missing, so I'm curious if anyone else is trying to use webpack and running into a similar issue, or if there's just something weird with my configuration. I'd expect to be able to just import it and have it work, but maybe I need to do something with those external libraries?

    Here's my test file for reference:

    import expect from 'expect';
    import { shallow } from 'enzyme';
    import React from 'react';
    import Button from '../Button';
    
    describe('Button', () => {
        it('should render children passed in', () => {
            const wrapper = shallow(
                <Button><div className="foo" /></Button>
            );
    
            expect(wrapper.contains(<div className="foo" />)).toBe(true);
        });
    });
    

    I won't paste the entire error log from webpack because it's pretty long, but here's a sample:

    
    WARNING in ./~/enzyme/~/jsdom/~/acorn/dist/acorn.js
    Critical dependencies:
    1:478-485 This seems to be a pre-built javascript file. Though this is possible, it's not recommended. Try to require the original source to get better results.
     @ ./~/enzyme/~/jsdom/~/acorn/dist/acorn.js 1:478-485
    
    WARNING in ./~/enzyme/~/jsdom/~/acorn/dist/walk.js
    Critical dependencies:
    1:503-510 This seems to be a pre-built javascript file. Though this is possible, it's not recommended. Try to require the original source to get better results.
     @ ./~/enzyme/~/jsdom/~/acorn/dist/walk.js 1:503-510
    
    ERROR in ./~/enzyme/build/react-compat.js
    Module not found: Error: Cannot resolve module 'react/lib/ExecutionEnvironment' in /Users/agoggin/www/vhosts/hammerhead/node_modules/enzyme/build
     @ ./~/enzyme/build/react-compat.js 22:2-43
    
    ERROR in ./~/enzyme/~/cheerio/index.js
    Module not found: Error: Cannot resolve module 'json' in /Users/agoggin/www/vhosts/hammerhead/node_modules/enzyme/node_modules/cheerio
     @ ./~/enzyme/~/cheerio/index.js 11:18-38
    
    ERROR in ./~/enzyme/~/jsdom/lib/jsdom.js
    Module not found: Error: Cannot resolve module 'fs' in /Users/agoggin/www/vhosts/hammerhead/node_modules/enzyme/node_modules/jsdom/lib
     @ ./~/enzyme/~/jsdom/lib/jsdom.js 6:9-22
    

    My webpack/karma config is pretty vanilla, but it'd help I can post that, too.

    bug Environment 
    opened by kgoggin 73
  • Testing component methods

    Testing component methods

    I couldn't find any information on this, if this is a duplicate excuse me for stealing your time.

    I'm trying to test this application, but I ran into a wall when testing component methods. As an example, take this component:

    class Button extends React.Component {
      handleClick() {
        // Do something here
      }
      render() {
        // Component here
      }
    }
    

    How could I test the handleClick method here when shallowly rendering this component? (The same question applies to lifecycle methods)

    opened by mxstbr 62
  • Error: This method is only meant to be run on single node. 0 found instead.

    Error: This method is only meant to be run on single node. 0 found instead.

    Clearly rendering a node. It's not picking it up..?

    render() {
        let groceriesComponents = [],
            newProductInput,
            newProductAddButton,
            clearListButton;
    
        for(var index = 0; index < this.state.groceries.length; index++) {
          groceriesComponents.push(
              <GroceryListItem
                key={index}
                grocery={this.state.groceries[index]}
              />
          );
        }
    
        newProductInput = <input className='new-item' type="text" onChange={this.inputChanged}/>;
        newProductAddButton = <button className='add-product' onClick={this.addGroceryItem}>Add new Product</button>;
        clearListButton = <button onClick={this.clearList} className='clear-list'>Clear the List</button>;
    
        return (
          <div>
            <ul>
              {groceriesComponents}
            </ul>
            {newProductInput}
            {newProductAddButton}
            {clearListButton}
          </div>
        );
      }
    }
    
    describe("Task #3 - clearing groceries list", () => {
    
        beforeEach( () => {
          component = mount(<GroceryListPart3 />);
        });
    
        it('Should render required tags', () => {
          try { component.find(".clear-list"); }
          catch(err){
            throw new Error("I can't find 'Clear the List' button");
          }
        });
    
        it('is possible to remove all list items', () => {
    
          let clearListButton = component.find(".clear-list");
          clearListButton.simulate('click');
          let groceryListItems = component.find("li");
    
          assert.equal(groceryListItems.length, 0, "There should be exactly zero elements on the groceries list");
        });
      });
    
    Error: This method is only meant to be run on single node. 0 found instead.
    
    opened by cameronroe 61
  • shallow().dive() does not work with react-redux Provider

    shallow().dive() does not work with react-redux Provider

    it('should work', () => {
      const Component = () => {
        return <div>Hello World</div>;
      };
      const wrapper = shallow(
        <Provider store={mockStore()}>
          <Component />
        </Provider>
      ).dive();
      expect(wrapper).toMatchSnapshot();
    });
    

    This is just a simple example - please assume that Component needs to have access to the react-redux context so I can use useSelector() in there, so something like .find(Component).dive() won't work

    Current behavior

    exports[`<UserMenu /> hopefully works 1`] = `<Component />`;
    

    Expected behavior

    exports[`<UserMenu /> hopefully works 1`] = `
    <div>
      Hello World
    </div>
    `;
    

    API

    • shallow

    Version

    | library | version | ------------------- | ------- | enzyme | 3.10.0 | react | 16.8.6 | react-dom | 16.8.6 | react-test-renderer | - | adapter (below) | 1.14.0

    Adapter

    • enzyme-adapter-react-16
    opened by ThiefMaster 59
  • Mount find() Does Not Find Rendered Marker

    Mount find() Does Not Find Rendered Marker

    This one is pretty frustrating. I mount this container. It does hit the code I expect that contains my css feature marker (ft-playback-error). But in the end I end up with not found.

    screencast of this issue: https://youtu.be/kh-UJTig3Qg

       it.only('renders a coordinates message in the player when no coordinates exist', () => {
          const store = createStore(reducers, {}),
    
            liveScreen = mount(
              <Provider store={createStore(reducers, {})}>
                <Live
                  breakpoint="site-web"
                  coordinates={null}
                  renderInfoInDetail={() => {}}
                  setOverlay={() => {}}
                  store={store}
                  AccessEnablerUrl=""
                  getUseUtagGlobal={() => {}}
                  pageViewEvent={() => {}}
                />
              </Provider>),
            message = liveScreen.find('.ft-playback-error');
    
          expect(message).to.have.length(1);
        });
    

    message.nodes ends up being 0 (or aka not found). Why? screen shot 2017-10-05 at 10 54 05 am

    I assumed when you mounted, it runs every child's render() (every child that's being hit down the codepath of container..obviously depending on whatever logic is in its render will determine which children are being rendered) method of this container.

    opened by dschinkel 58
  • Support React 16

    Support React 16

    React is currently in v16.0.0-alpha.12, but is it already planned to support it by enzyme? My specific issue currently is #875.

    Is it too early to implement it, as it is in alpha?

    opened by JPeer264 54
  • Method “props” is only meant to be run on a single node. 0 found instead.

    Method “props” is only meant to be run on a single node. 0 found instead.

    Method “props” is meant to be run on 1 node. 0 found instead.

     const commentTextInput = findByTestAttr(wrapper, 'clockings-add-comment');  
    
    console.log("testing1:"+commentTextInput.props().spellcheck)
    
    

    Thanks for reporting an issue to us! We're glad you are using and invested in Enzyme. Before submitting, please read over our commonly reported issues to prevent duplicates!

    All common issues

    Notoriously common issues

    If you haven't found any duplicated issues, please report it with your environment!

    Current behavior

    Expected behavior

    Your environment

    API

    • [x] shallow
    • [ ] mount
    • [ ] render

    Version

    | library | version | ------------------- | ------- | enzyme | | react | | react-dom | | react-test-renderer | | adapter (below) |

    Adapter

    • [ ] enzyme-adapter-react-16
    • [ ] enzyme-adapter-react-16.3
    • [ ] enzyme-adapter-react-16.2
    • [ ] enzyme-adapter-react-16.1
    • [ ] enzyme-adapter-react-15
    • [ ] enzyme-adapter-react-15.4
    • [ ] enzyme-adapter-react-14
    • [ ] enzyme-adapter-react-13
    • [ ] enzyme-adapter-react-helper
    • [ ] others ( )
    Need More Information 
    opened by Pinturaj 1
  • add enzyme-adapter-react-17

    add enzyme-adapter-react-17

    Stacked on #2534 (Diff against #2534)

    Compared to https://github.com/enzymejs/enzyme/pull/2534/:

    • less React 17 branching in tests (goal is 0 branching but branching for error stacks is probably fine)
    • some legacy code removed

    TODO: Open to discussing the remaining items @ljharb

    • [ ] callstack/componentstack Would need to discuss if we want to normalize them across React versions. For the initial release I would lean towards being ok with different stacks between 16 and 17 since that's also what developers experience.
    • [x] hide internal Suspense fibers
    • [x] Green CI
    • [x] code coverage hygiene

    Closes https://github.com/enzymejs/enzyme/issues/2429 Closes https://github.com/enzymejs/enzyme/pull/2534 Closes https://github.com/enzymejs/enzyme/pull/2430

    opened by eps1lon 13
  • Cannot read property 'child' of undefined on React 16 + enzyme-adapter-react-16

    Cannot read property 'child' of undefined on React 16 + enzyme-adapter-react-16

    Current behavior

    import React from "react";
    import { mount } from "enzyme";
    import NewTagModal from "./NewTagModal";
    
    describe("New Tag Modal", () => {
      let component;
      function mountComponent() {
        return mount(
          <NewTagModal isOpen={true} />;
        );
      }
    
      beforeEach(() => {
        component = mountComponent();
      });
    
      it("has a title", () => {
        expect(component.find("h4").text()).toBe("Create New Tag");
      });
    });
    

    Returns:

        TypeError: Cannot read property 'child' of undefined
    
          72 |
          73 |   function mountComponent() {
        > 74 |     return mount(
    
          at getFiber (../../../node_modules/enzyme-adapter-react-16/src/detectFiberTags.js:15:35)
          at detectFiberTags (../../../node_modules/enzyme-adapter-react-16/src/detectFiberTags.js:76:15)
          at ReactSixtee^C
    

    Expected behavior

    Tests pass

    API

    • [ ] shallow
    • [x] mount
    • [ ] render

    Version

    | library | version | ------------------- | ------- | enzyme | 3.11.0 | react | 16.4.0 | react-dom | 16.4.0 | react-test-renderer | n/a | adapter (below) | enzyme-adapter-react-16

    Adapter

    • [x] enzyme-adapter-react-16
    • [ ] enzyme-adapter-react-16.3
    • [ ] enzyme-adapter-react-16.2
    • [ ] enzyme-adapter-react-16.1
    • [ ] enzyme-adapter-react-15
    • [ ] enzyme-adapter-react-15.4
    • [ ] enzyme-adapter-react-14
    • [ ] enzyme-adapter-react-13
    • [ ] enzyme-adapter-react-helper
    • [ ] others ( )
    Need More Information 
    opened by dep 1
  • Bump cheerio to @1.0.0-rc.11

    Bump cheerio to @1.0.0-rc.11

    Due to recent security vulnerability in nth-checkv1.2.0 which is fetched transitively from enzyme --> cheerio --> css-select --> .... --> nth-checkv1.2.0.

    [email protected] removes dependency of css-select which ultimately removes dependency of nth-check

    opened by vinodkumarsharma276 4
  • Add contextType support

    Add contextType support

    @ljharb I've rebased #2507 , applied your suggestions and added test cases for dynamic context values. Unfortunately, the test which uses wrappingComponent does not pass, it keeps rendering the initial context value. The context is correctly updated in the RootFinder though, but it's not propagated down the tree.

    I tried my best to understand what is happening but I don't understand yet how things work internally yet. If you have any hint to point me in the right direction, I'll gladly move this PR forward.

    Thank you for all the great work :)

    package: react adapter: 16 
    opened by pablopalacios 7
Owner
enzyme - JavaScript Testing utilities for React
enzyme - JavaScript Testing utilities for React
JavaScript Testing utilities for React

Enzyme Enzyme is a JavaScript Testing utility for React that makes it easier to test your React Components' output. You can also manipulate, traverse,

enzyme - JavaScript Testing utilities for React 20k Nov 30, 2022
Delightful JavaScript Testing.

?? Delightful JavaScript Testing ????‍?? Developer Ready: A comprehensive JavaScript testing solution. Works out of the box for most JavaScript projec

Facebook 40.8k Nov 28, 2022
Chai.js assertions and convenience functions for testing React Components with enzyme

chai-enzyme Chai.js assertions for enzyme. Table of Contents Installation Setup Debug output in assertion exceptions Assertions 1. checked() 1. classN

Product Hunt 792 Nov 13, 2022
⚛️ React testing made easy. Supports DOM and custom renderers.

Rut Rut is a DOM-less React testing library that aims to be lightweight, encourage great testing practices, and reduce flakiness and code smells. It i

Miles Johnson 15 May 22, 2022
Plugin for http://unexpected.js.org to enable testing the full React virtual DOM, and also the shallow renderer

unexpected-react Plugin for unexpected to allow for testing the full virtual DOM, and against the shallow renderer (replaces unexpected-react-shallow)

Dave Brotherstone 185 Nov 22, 2022
React.js - Testing playground: States and props, component lifecycle, State Hooks

ReactPlayground React.js - Testing playground: States and props, component lifecycle, State Hooks App.js: Testing states and props. Calling this.setSt

null 1 Jul 7, 2022
Mock your React Components for the amazing snapshot testing

Mock your React Components for the amazing snapshot testing. This package allows you to avoid lots of braking tests of parent components if one child

Denys Kohut 4 Jul 28, 2022
Code sample for showcasing basic React Testing Library

?? React Testing Workshop Code sample for showcasing basic React Testing Library Available Scripts In the project directory, you can run: npm start Ru

Irfan Maulana 25 Sep 15, 2022
An isolated development space with integrated fuzz testing for your components. See them individually, explore them in different states and quickly and confidently develop them.

Carte Blanche IMPORTANT: This project is unfinished and not maintained. Do not try to use it, it likely does not work anymore. Carte Blanche is an iso

Carte Blanche 1.5k Nov 20, 2022
A library for testing classes with auto mocking capabilities using jest-mock-extended

Jest Unit ?? Library for Writing Unit Tests Easily with Auto Mocking Capabilities for TypeScript & Jest Create unit test simply and easily with 100% i

Omer Morad 46 Dec 2, 2022
A quick ERC-20 tutorial with testing, fuzzing and more.

A quick ERC-20 tutorial with testing, fuzzing and more. Our Approach This tutorial will help you learn web3 with three principles in m

Anthony Albertorio 4 Jul 5, 2022
Create, isolate and test modular UI components in React.

ui-harness Isolate, test and document modular UI with React using familiar describe/it testing semantics. http://uiharness.com Quick Start (1-minute)

Phil Cockfield 269 Sep 27, 2022
This project implements an online shopping application to show techniques used to test React applications.

This project implements an online shopping application to show techniques used to test React applications.

Naresh Bhatia 53 Dec 3, 2022
A simple pink button to test react library

pinkbtn A simple pink button to test react library concept Install npm install --save pinkbtn Usage import React, { Component } from 'react' import M

Felipe Costa 0 Oct 29, 2021
React Bricks Test

React Bricks starter with Next.js with Tailwind CSS and React Bricks UI Kick-start your project with this boilerplate for a complete Next.js website b

Dawid Dahl 1 Nov 7, 2021
Adam-rms-v2 - Rental Management System for Theatre, AV & Broadcast,written in react

AdamRMS is an advanced Rental Management System for Theatre, AV & Broadcast, wri

AdamRMS 4 Nov 30, 2022
Sandbox to test Vite/vitest bundler & React 18.

Vite + React 18 Introduction What is vite ? : is a build tool that aims to provide a faster and leaner development experience for modern web projects.

Gabin Bloquet 1 Apr 4, 2022
Use esbuild in your create-react-app for faster compilation, development and tests

?? create-react-app-esbuild ?? Use esbuild in your create-react-app for faster compilation, development and tests. Features Replace babel-loader with

Léo Pradel 536 Dec 1, 2022
It provides a more standardized, efficient and easy to test functional programming method in react.

It provides a more standardized, efficient and easy to test functional programming method in react.

北海虽赊,扶摇可接;东隅已逝,桑榆非晚。 1 Apr 16, 2022