enzymejs/enzyme

Zero documentation for `configure()` options

Offen

#2.533 geöffnet am 09.08.2021

 (5 Kommentare) (2 Reaktionen) (0 zugewiesene Personen)JavaScript (1.967 Forks)batch import
docshelp wanted

Repository-Metriken

Stars
 (19.825 Sterne)
PR-Merge-Metriken
 (Keine gemergten PRs in 30 T)

Beschreibung

Current behavior

No resources anywhere show how to configure Enzyme outside of configure({ adapter: new MyAdapter() }), including the home page, GitHub ReadMe, test library guides, and adapter guides.

There are clearly ways to configure enzyme and adapters, but it's not clear if they should be done via:

  1. configure({ adapter: new MyAdapter({ ...myOptions )) })
  2. configure({ adapter: new MyAdapter(), ...myOptions })
  3. configure({ adapter: new MyAdapter({ ...someOptions }), ...otherOptions })

Expected behavior

Each and every function, especially those with configurable options and even more especially those created by the enzyme team itself, to be documented. We should be able to see pages like

Configure enzyme like this

configure({
    optName: type || [ validOptValue1, validOptValue2, ...],
    // ...
})

and

Configure enzyme adapters like this

configure({
    adapter: new Adapter({
        optName: type || [ validOptValue1, validOptValue2, ...],
        // ...
    }),
    // or alternatively here, who knows right now, it's not documented anywhere!
})

and

Configure enzyme-adapter-react-16 like this

configure({
    adapter: new Adapter({
        react16SpecificOption: type || [ validOptValue1, validOptValue2, ...],
        // ...
    }),
    // or alternatively here, who knows right now, it's not documented anywhere!
})

Example

FWIW, what I wanted to do was to change enzyme-adapter-react-16's getSnapshotBeforeUpdate to false so it waits for updates before taking snapshots, globally, for every test (suite).

Your environment

API

  • shallow
  • mount
  • render

Version

library version
enzyme 3.11.0, also tried 3.10.0
react 16.13.1
react-dom 16.13.1
react-test-renderer 16.13.1
enzyme-adapter-react-16 1.15.6, also tried 1.14.0

Contributor Guide