Enzyme: Enzyme Internal Error: unknown node with tag 12

Created on 13 Apr 2018  路  13Comments  路  Source: enzymejs/enzyme

Current behavior

React in version 16.3 introduces new Context API. That API comes with two new node types (12 and 13).
These node types are not supported and therefore enzyme-adapter-react-16 is throwing an error:

# for ContextConsumer
Enzyme Internal Error: unknown node with tag 12

or

# for ContextProvider
Enzyme Internal Error: unknown node with tag 13

when you use Context API inside your React components.

An example:

import React from 'react';
import { mount } from 'enzyme';

const { Provider, Consumer } = React.createContext();
const Component = () => (
  <Provider value="test">
    <Consumer>{value => <span>{value}</span>}</Consumer>
  </Provider>
);

mount(<Component />); // this will thrown an error mentioned earlier

Expected behavior

New node types are handled correctly.

API

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

Version

| library | version
| ---------------- | -------
| Enzyme | ^3.3.0
| React | ^16.3.0

Adapter

  • [x] enzyme-adapter-react-16

All 13 comments

@kkwiatkowski this is a duplicate of https://github.com/airbnb/enzyme/issues/1509, which has already been fixed by https://github.com/airbnb/enzyme/pull/1513. Just waiting on a release by enzyme 馃槩

@baldwmic thanks for your answer. For some reason I couldn't find anything around it.

Did this fix get released yet?
I still have this problem on Enzyme v3.3.0 with enzyme-adapter-react-16 v 1.1.1

No, not yet. Please be patient.

Sorry to ping here, but any ETA on the release? This is blocking a lot of people, I'd suspect. Basically we aren't able to move to the new context without breaking existing enzyme tests.

No ETA just yet. I understand the frustration and that it's blocking many people, including Airbnb, from using many of React 16's new features.

It will be released as soon as it's ready.

@ljharb just chiming in to say thanks for taking the time to do it right. Enzyme is an amazing library!

@ljharb Is there an issue we can follow that isn't closed to check on the progress of a fix here getting published?

@msluther #1553

@ljharb Thank you! 馃槃

I got this problem with _"enzyme": "^3.9.0"_

@Fl4v10 please file a new issue

Was this page helpful?
0 / 5 - 0 ratings

Related issues

rexonms picture rexonms  路  3Comments

blainekasten picture blainekasten  路  3Comments

SandroMachado picture SandroMachado  路  3Comments

potapovDim picture potapovDim  路  3Comments

AdamYahid picture AdamYahid  路  3Comments