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

improve Preact testing & documentation #41

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

improve Preact testing & documentation #41

brodybits opened this issue Jan 26, 2023 · 0 comments

Comments

@brodybits
Copy link
Collaborator

Many but not all of the tests will succeed with Preact with help from enzyme-adapter-preact-pure.

Need to sort out what needs to be resolved between the test setup, test cases, and source code.

I think it would be ideal if we could port out of Enzyme as discussed in issue #40.

brodybits added a commit that referenced this issue Jan 26, 2023
as discussed in:

- #41

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

    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

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
as discussed in:

- #41

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

    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

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
as discussed in:

- #41

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

    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

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 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 fix Preact support & testing improve Preact testing & documentation Mar 3, 2023
brodybits added a commit that referenced this issue Mar 3, 2023
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

1 participant