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

testing beyond React 17 - consider replacing enzyme #40

Open
brodybits opened this issue Jan 26, 2023 · 0 comments
Open

testing beyond React 17 - consider replacing enzyme #40

brodybits opened this issue Jan 26, 2023 · 0 comments
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@brodybits
Copy link
Collaborator

brodybits commented Jan 26, 2023

UPDATED STATUS:

  • only 1 test still not working with React 18
  • still may not be future-proof beyond React 18

ref:


Alternatives I can think of:

@brodybits brodybits added bug Something isn't working help wanted Extra attention is needed labels Jan 26, 2023
brodybits added a commit that referenced this issue Jan 26, 2023
with a number of test cases not working, as discussed in:

- #40
brodybits added a commit that referenced this issue Jan 26, 2023
with a number of test cases not working, as discussed in:

- #40
- #41

how to test React 18 from command line (as specified in the new CI workflow):

    yarn add --dev react@18 react-dom@18 enzyme-adapter-react-16@npm:@cfaester/enzyme-adapter-react-18
    npx cross-env TEST_WITH_REACT_18=1 jest

how to test Preact from command line:

    yarn add --dev react@npm:@preact/compat react-dom@npm:@preact/compat enzyme-adapter-react-16@npm:enzyme-adapter-preact-pure preact@latest
    npx cross-env TEST_WITH_PREACT=1 jest

Preact guides for reference:

- https://preactjs.com/guide/v10/switching-to-preact/
- https://preactjs.com/guide/v10/getting-started/#aliasing-react-to-preact
- https://preactjs.com/guide/v10/unit-testing-with-enzyme/
brodybits added a commit that referenced this issue Jan 26, 2023
with a number of test cases not working, as discussed in:

- #40
- #41

how to test React 18 from command line (as specified in the new CI workflow):

    yarn add --dev react@18 react-dom@18 enzyme-adapter-react-16@npm:@cfaester/enzyme-adapter-react-18
    npx cross-env TEST_WITH_REACT_18=1 jest

how to test Preact from command line:

    yarn add --dev react@npm:@preact/compat react-dom@npm:@preact/compat enzyme-adapter-react-16@npm:enzyme-adapter-preact-pure preact@latest
    npx cross-env TEST_WITH_PREACT=1 jest

Preact guides for reference:

- https://preactjs.com/guide/v10/switching-to-preact/
- https://preactjs.com/guide/v10/getting-started/#aliasing-react-to-preact
- https://preactjs.com/guide/v10/unit-testing-with-enzyme/
brodybits added a commit that referenced this issue Jan 31, 2023
- wrap some updates in act() wrapper from react-dom/test-utils
  (or preact/test-utils for Preact), using simple actWith()
  test utility function in many cases, to get
  some tests working with Preact & React 18
- update CI workflow labels
- show console warnings for tests that still need to be skipped
- other minor updates

related issues:

- #40
- #41
brodybits added a commit that referenced this issue Jan 31, 2023
- wrap some updates in act() wrapper from react-dom/test-utils
  (or preact/test-utils for Preact), using simple actWith()
  test utility function in many cases, to get
  some tests working with Preact & React 18
  (without breaking on React 16)
- update CI workflow labels
- show console warnings for tests that still need to be skipped
- other minor updates

related issues:

- #40
- #41

PR ref: #48
@brodybits brodybits changed the title testing beyond React 17 - may need to replace enzyme testing beyond React 17 - consider replacing enzyme Feb 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

1 participant