Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Working with React 16 docs don't match the Readme #1159

Closed
alanbsmith opened this issue Sep 26, 2017 · 6 comments
Closed

Working with React 16 docs don't match the Readme #1159

alanbsmith opened this issue Sep 26, 2017 · 6 comments

Comments

@alanbsmith
Copy link

Heyo! First, thanks for all you do. I ❤️ Enzyme, and I appreciate you maintaining it. 😄

Overview

The docs here on AirBnB do not seem to match the docs in the README here. I assume they just need to be pushed up.

Instead of enzyme-adapter-react-16 it says enzyme-react-adapter-16.

Your error message:

          Enzyme Internal Error: Enzyme expects an adapter to be configured, but found none. To
          configure an adapter, you should call `Enzyme.configure({ adapter: new Adapter() })`
          before using any of Enzyme's top level APIs, where `Adapter` is the adapter
          corresponding to the library currently being tested. For example:

          import Adapter from 'enzyme-adapter-react-15';

          To find out more about this, see http://airbnb.io/enzyme/docs/installation/index.html

pointed me to this doc, which is how I found it.

Screenshots

README

screen shot 2017-09-26 at 4 38 38 pm

AirBnB Site Docs

screen shot 2017-09-26 at 4 38 45 pm

It's a pretty small thing and should be a quick fix. 😄 Thanks again for all you do!

@Rob-Leggett
Copy link

Rob-Leggett commented Sep 27, 2017

+1

Please also note the following suggestion.

Currently the doc specifies...

// setup file
import { configure } from 'enzyme';
import Adapter from 'enzyme-adapter-react-16';

configure({ adapter: new Adapter() });

However the doc would be better to state...

// setup file
import { configure } from 'enzyme';
import * as ReactSixteenAdapter from 'enzyme-adapter-react-16';

configure({ adapter: new ReactSixteenAdapter() });

@ljharb
Copy link
Member

ljharb commented Sep 27, 2017

The docs are fixed in #1142.

@Rob-Leggett no, import * as is both incorrect here, and never necessary. The adapters have a single default export; import * as provides a ModuleRecord object with a ".default" property.

@ljharb ljharb closed this as completed Sep 27, 2017
@alanbsmith
Copy link
Author

Correct, the docs are fixed in the README. But the site docs are not (as of now).
http://airbnb.io/enzyme/docs/installation/index.html#

This is still there:

npm i --save-dev enzyme enzyme-react-adapter-16

Thanks again for working on this.

@ljharb
Copy link
Member

ljharb commented Sep 27, 2017

That won't be fixed until the next release.

@alanbsmith
Copy link
Author

Sounds good. 👍 Appreciate your time!

@papaponmx
Copy link

There is a typo on the docs, this is the correct name for the package https://www.npmjs.com/package/enzyme-adapter-react-16

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants