Skip to content

Ignoring attachTo and hydrateIn options set in enzyme.configure #1836

@ah-adarlow

Description

@ah-adarlow

Describe the bug
attachTo and hydrateIn options set in enzyme.configure are ignored.

To Reproduce
In a mocha test suite, add the following code in a before section:

  const node = document.createElement('div');
  node.className = 'my-class';

  enzyme.configure({ attachTo: node });

Then in a test, mount any node without options and test whether its parent in the DOM has the class my-class. It doesn't.

Expected behavior
If attachTo is set in configure and not set in the options when calling mount the option from configure should be used.

Additional context
The issue originated in #1707 and is due to how mountTargets gets merged with the configuration. Even if a mount target is undefined it still overrides the configuration.

I can submit a PR to fix this at some point, but I'm not sure when I'll get around to it. I'm happy for someone else to pick it up earlier if they want to.

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