Skip to content

Automated Testing: Unskip tests blocked by Enzyme support of React 16.3 #7005

Closed

Description

@aduth

Previously: https://github.com/WordPress/gutenberg/pull/6527/files#r185974677

We currently skip tests which rely on React.forwardRef because they are not supported yet by Enzyme:

// Disable reason: This test is desirable, but unsupported by Enzyme in
// the current version, as it depends on features new to React in 16.3.0.
//
// eslint-disable-next-line jest/no-disabled-tests
describe.skip( 'ref forwarding', () => {
it( 'should enable access to DOM element', () => {
const ref = createRef();
mount( <ButtonWithForwardedRef ref={ ref } /> );
expect( ref.current.nodeName ).toBe( 'button' );
} );
} );

This is tracked by the Enzyme project at enzymejs/enzyme#1604

Once the above issue is closed and Enzyme produces a new release introducing support for React.forwardRef, we should remove the workarounds introduced by #6527 .

Open questions:

  • What else do we use from React 16.3 that isn't supported by Enzyme that will need to be updated?
  • What components other than Button have tests which need to be updated?

Activity

  1. added
    [Type] TaskIssues or PRs that have been broken down into an individual action to take
    Good First IssueAn issue that's suitable for someone looking to contribute for the first time
    [Type] Automated TestingTesting infrastructure changes impacting the execution of end-to-end (E2E) and/or unit tests.
    [Status] BlockedUsed to indicate that a current effort isn't able to move forward
    on May 29, 2018
  2. gziolo commented on May 29, 2018

    @gziolo
    Member

    I just wanted to add that all tests that we skip currently are blocked by Enzyme's upgrade.

  3. removed
    [Status] BlockedUsed to indicate that a current effort isn't able to move forward
    on Jul 13, 2018
  4. gziolo commented on Jul 13, 2018

    @gziolo
    Member

    This is how similar issues were fixed by @nerrad using React.TestUtils: #7835, #7834. We should go this route instead of waiting for enzyme to be upgraded.

  5. nerrad commented on Jul 13, 2018

    @nerrad
    Contributor

    Ya although its a pain, the more you work react-test-utils, and react-dom/test-utilities the less of a hassle it becomes. Definitely more reliable. It's kind of odd that the official react docs still suggest using enzyme.

  6. nerrad commented on Jul 13, 2018

    @nerrad
    Contributor

    Also worth noting that under the hood enzyme uses the various react test utilities.

  7. aduth commented on Jul 18, 2018

    @aduth
    MemberAuthor

    Can we make sure to cross-reference pull requests meant to be addressing (or partially addressing) this issue.

  8. nerrad commented on Jul 18, 2018

    @nerrad
    Contributor

    As far as I know there's only one skipped (unit) test now.

  9. aduth commented on Jul 18, 2018

    @aduth
    MemberAuthor

    Which pull requests are those? I'd like to keep record here for historical purposes.

  10. nerrad commented on Jul 18, 2018

    @nerrad
    Contributor

    The pulls I fixed skipped tests related to this were:

    The pulls I converted away from enzyme (because they failed in #7557) are:

  11. aduth commented on Aug 9, 2018

    @aduth
    MemberAuthor

    We no longer use Enzyme.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Good First IssueAn issue that's suitable for someone looking to contribute for the first time[Type] Automated TestingTesting infrastructure changes impacting the execution of end-to-end (E2E) and/or unit tests.[Type] TaskIssues or PRs that have been broken down into an individual action to take

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions