Skip to content
This repository has been archived by the owner on Mar 12, 2020. It is now read-only.

Look into replacing Enzyme with ReactTestUtils #577

Closed
sarahscott opened this issue May 31, 2017 · 11 comments
Closed

Look into replacing Enzyme with ReactTestUtils #577

sarahscott opened this issue May 31, 2017 · 11 comments
Assignees

Comments

@sarahscott
Copy link
Contributor

Enzyme doesn't support the new version of React, and it could become difficult to maintain in the future. We should try to use the ReactTestUtils instead.

@alloy
Copy link
Contributor

alloy commented May 31, 2017

Can you add the link to the Enzyme ticket?

@sarahscott
Copy link
Contributor Author

enzymejs/enzyme#953

@alloy
Copy link
Contributor

alloy commented Jun 7, 2017

Done in #583

@alloy alloy closed this as completed Jun 7, 2017
@orta orta reopened this Jun 13, 2017
@orta
Copy link
Contributor

orta commented Jun 13, 2017

[moved to #559]

@orta
Copy link
Contributor

orta commented Jun 13, 2017

also ReactTestUtils only are for react-dom I think

@alloy
Copy link
Contributor

alloy commented Jun 13, 2017

Not this ticket, I think, because this ticket was about removing enzyme.

And what’s the problem with ReactTestUtils being liited to react-dom?

@orta
Copy link
Contributor

orta commented Jun 13, 2017

React-dom is only for the web

@orta
Copy link
Contributor

orta commented Jun 13, 2017

Alright, I'll bring #559 back to life

@orta orta closed this as completed Jun 13, 2017
@alloy
Copy link
Contributor

alloy commented Jun 13, 2017

Hrm, afaik ReactTestUtils is supposed to work fine with RN.

@orta
Copy link
Contributor

orta commented Jun 13, 2017

They require a DOM, which RN doesn't have, for example:

import * as React from "react"
import * as ReactTestUtils from "react-dom/test-utils"

  it("calls goto Artist on to the artist button", () => {
    const testFunc = jest.fn()
    const d = ReactTestUtils.renderIntoDocument(<TODO goToArtist={testFunc} />)
    const a = ReactTestUtils.findAllInRenderedTree(d, c => true)
    console.log(a)
  })

Doesn't load:

screen shot 2017-06-13 at 17 50 46

@alloy
Copy link
Contributor

alloy commented Jun 13, 2017

Ah right, you’ll probably need to add JSDOM or something

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

No branches or pull requests

3 participants