question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Enzyme Internal Error: unknown node with tag 2

See original GitHub issue

Current behavior

` Enzyme Internal Error: unknown node with tag 2

  19 | ): ReactWrapper => {
  20 |   const el = (): JSX.Element => component;
> 21 |   return mount(<Provider store={store}>{el()}</Provider>);
     |          ^
  22 | };`

from:

import { shallow, ShallowWrapper, mount, ReactWrapper } from "enzyme";
import React, { ReactElement } from "react";
import { Provider } from "react-redux";
import { MockStoreEnhanced } from "redux-mock-store";

export const shallowWithStore = (
  component: ReactElement,
  store: MockStoreEnhanced
): ShallowWrapper => {
  const context = {
    store
  };
  return shallow(component, { context });
};

export const mountWithStore = (
  component: ReactElement,
  store: MockStoreEnhanced
): ReactWrapper => {
  const el = (): JSX.Element => component;
  return mount(<Provider store={store}>{el()}</Provider>);
};

I’m using react-i18next and suspect it could be to do with the export:

export default withTranslation()(
  withRouter(
    connect(
      mapStateToProps,
      mapDispatchToProps
    )(HomePage)
  )
);

Expected behavior

No error.

API

  • shallow
  • mount
  • render

Version

library version
enzyme 3.9.0
react 16.8.5
react-dom 16.8.4
react-test-renderer
adapter (below) 1.13.0

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 ( )

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:8 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
JonathanTyrrellcommented, May 22, 2019

Working on the repro test case. I’ll upload when I have it ready.

0reactions
ljharbcommented, May 29, 2019

I’m not sure what Fetch is (unless you mean fetch) - did this happen because you rendered a Promise?

Read more comments on GitHub >

github_iconTop Results From Across the Web

React unit test - Enzyme Internal Error: unknown node with tag 2
React unit test - Enzyme Internal Error: unknown node with tag 2 ... Need help to resolve this issue. reactjs · jestjs ·...
Read more >
Enzyme Internal Error: unknown node with tag 2 - Bountysource
Getting error Enzyme Internal Error: unknown node with tag 2. from mounting Suspense component with child component that throws promise:
Read more >
enzymejs/enzyme - Gitter
<div data-test="selectClosedDropDown" className={css(styles.value(error, ... (Mac OS X 10.15.6) Error: Enzyme Internal Error: unknown node with tag 15
Read more >
Unknown Node With Tag 15 Using React Boiler Plate - ADocLib
Enzyme Internal Error : Unknown Node With Tag 15 Using React Boiler Plate ... code ELIFECYCLE npm ERR! errno 1 Code Answer's Step...
Read more >
Top 5 enzyme-adapter-utils Code Examples - Snyk
Learn more about how to use enzyme-adapter-utils, ... default: throw new Error(`Enzyme Internal Error: unknown node with tag ${node.tag}`); } }.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found