Enzyme: Invalid propType warning when rendering a Provider with no surrounding elements

Created on 8 Aug 2018  路  1Comment  路  Source: enzymejs/enzyme

Describe the bug

When rendering a Provider and its Consumer directly (with no surrounding elements), a propType warning gets emitted.

To Reproduce
Steps to reproduce the behavior:

import React from 'react';
import ReactDOM from 'react-dom';
import { mount } from 'enzyme';

const { Provider, Consumer } = React.createContext();
const element = (
  <Provider value="hello world">
    <Consumer>{greeting => greeting}</Consumer>
  </Provider>
);

ReactDOM.render(element, document.createElement('div')); // No warning, renders as expected

mount(element); // renders as expected, but yields the following warning:
/*
Warning: Failed prop type: Invalid prop `Component` supplied to `WrapperComponent`.
        in WrapperComponent
*/

mount(<div>{element}</div>); // No warning, renders as expected

Expected behavior
I'd expect no warning to be emitted.

Desktop (please complete the following information):

  • OS: macOS 10.13.6
  • Versions:

    • Node 8.11.3

    • react 16.4.2

    • react-dom 16.4.2

    • enzyme 3.4.0

    • enzyme-adapter-react-16 1.2.0

Most helpful comment

I can't reproduce the issue anymore after updating enzyme to 3.5.0 and enzyme-adapter-react-16 1.3.0. I'm going to go ahead and close this since it appears to have been resolved 馃檪

>All comments

I can't reproduce the issue anymore after updating enzyme to 3.5.0 and enzyme-adapter-react-16 1.3.0. I'm going to go ahead and close this since it appears to have been resolved 馃檪

Was this page helpful?
0 / 5 - 0 ratings