enzyme v3.4.0 Release Notes

  • 🆕 New Stuff

    • @madicap: shallow/mount: account for React.Fragment nodes (#1733)
    • @jquense: Debug: debugNode now returns [function] for function children (commit)
    • @ljharb: mount: add hydrateIn option (#1707)
    • @ljharb: shallow: add “lifecycles” adapter option (#1696)
    • @krawaller: shallow/mount: allow .exists() to take an optional selector (#1695)
    • ⚡️ @koba04: shallow: Add getSnapshotBeforeUpdate support (#1657)
    • 👍 @jquense: shallow/mount: Add support for some pseudo selectors (#1537)
    • @blainekasten: debug: Implement verbose debug output (#1547)
    • @jquense/@ljharb: Debug: typeName now calls the adapter’s displayNameOfNode if available (#1701)
    • @jquense/@ljharb: mount/shallow: .name(): call into adapter’s displayNameOfNode, if present (#1701)
    • @jquense/@ljharb: Utils: nodeHasType: call into adapter’s displayNameOfNode, if present (#1701)
    • 🏗 @jquense/@ljharb: selectors: buildPredicate: call into adapter’s isValidElementType, if present (#1701)
    • @emuraton/@ljharb: shallow: setProps(): Add callback argument (#1721)
    • @ljharb: mount: add .equals() (commit)
    • @madicap: Extract getAdapter from Utils into its own file (#1732)

    🛠 Fixes

    • @ljharb: shallow/mount: matchesElement/containsMatchingElement: get adapter with options (commit)
    • 🚚 @ljharb: RSTTraversal: remove nodeHasProperty export; broken since #1157 (commit)
    • @ljharb/@KordonDev: shallow: .at(): return an empty wrapper when an index does not exist (#1478)
    • @ljharb: shallow: .equals(): flatten children when comparing (commit)
    • @ljharb: mount/shallow: do not dedupe in flatMap (commit)
    • @ljharb: shallow: .closest(): ensure an empty wrapper is returned for no match (commit)
    • @krawaller: selectors: make general sibling not throw on root (#1698)
    • @ljharb/@angelikatyborska : mount: text(): null nodes return null (#1582)
    • @ljharb: shallow: simulate: ensure it returns itself (commit)
    • ⚡️ @koba04: shallow: ShallowWrapper calls update() automatically (#1499)
    • @bdwain: mount/shallow: return null for missing keys (#1536)
    • @vsiao: Fix ShallowWrapper for array-rendering components (#1498)
    • @koba04: Call setState callback after finishing the render (#1453)
    • @eddyerburgh: Convert nodes to RST nodes before comparing (#1423)
    • @ljharb: improve "bad adapter" error message (#1477)
    • 0️⃣ @ljharb: shallow/mount: default iterator should be iterable (commit)

    🔨 Refactors

    • ✏️ @ReactiveRaven: selectors: fix typos; avoid reusing variable unnecessarily (#1681)
    • ⚡️ @koba04/@ljharb: shallow: Use spyMethod to inspect the result of shouldComponentUpdate/getSnapshotBeforeUpdate (#1192)
    • 🔧 @ljharb: Utils: configuration: change to named exports. (commit)
    • @ljharb: use array.prototype.flat (commit)

    📚 Documentation

    • @jack-lewin: Clarify dev workflow in CONTRIBUTING.md (#1207)
    • @robrichard: Provide migration instructions for ref(refName) (#1470)
    • @DannyDelott: shallow/mount: Add callback arg to setProps header (#1361)
    • ⚡️ @conor-cafferkey-sociomantic: mount: Updated docs for ReactWrapper.instance(); remove docs for v2's getNode()/getNodes() (#1714)
    • 📄 @koba04: Make clearer the docs for .mount() (#1540)
    • ⚡️ @ialexryan: Update signature of .type() in shallow.md (#1492]([https://github.com/enzymejs/enzyme/pull/1492))

    Meta Stuff

    • 📦 @ljharb: ensure a license and readme is present in all packages when published
    • 📦 @ljharb: [meta] fix package.json scripts