Skip to content

New React context API adds new tag types #1509

@lourd

Description

@lourd

The new API for context, publicly released just a few hours ago in the React 16.3 alpha, adds new tag types for the Provider and Consumer components that are returned from the createContext function.

When updating my module to use the new API, I get an unknown node error from the ReactSixteenAdapter.js:

Enzyme Internal Error: unknown node with tag 13

I went in and took a stab at updating the adapter, and found that the Consumer prop has another new tag type, 12.

I added the following lines:

+ var ContextProvider = 13
+ var ContextConsumer = 12

and tried adding cases for both of those in the module's switch statement, but none of the existing case handling options worked to get my tests passing again.

Environment

API

  • shallow
  • mount
  • render

Version

library version
Enzyme 3.3.0
React 16.3.0-alpha.0

Adapter

  • enzyme-adapter-react-16
  • enzyme-adapter-react-15
  • enzyme-adapter-react-15.4
  • enzyme-adapter-react-14
  • enzyme-adapter-react-13
  • enzyme-adapter-react-helper

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions