-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Closed
Labels
BugSomething is broken and not working as intended in the system.Something is broken and not working as intended in the system.
Description
Polaris-react has two ways of running tests:
- The modern way:
import {mountWithApp} from 'test-utilities'
which uses@shopify/react-testing
per this file. - The legacy way:
import {mountWithAppProvider} from 'test-utilities/legacy'
which usesenzyme
per this file.
In order to simplify our testing story and only have one way of doing things we should remove all usage of enzyme and test-utilities/legacy
, cumulating in removing src/test-utilities/legacy.tsx
and all enzyme dependencies.
In order to do this however we need to migrate all the tests that currently use test-utilities/legacy
. That's where you come in.
1 Migrating tests
- Search the codebase for
test-utilities/legacy
to find imports of that file. - Replace
import {mountWithAppProvider} from 'test-utilities/legacy'
withimport {mountWithApp} from 'test-utilities'
and migrate the test content so it passes - TODO there's probably some docs from "how to to migrate from enzyme to react-testing" that came out of doing this work in web. Hunt them down and link them here.
@vsumner had some codemods that helped auto migrating the web codebase they might cover a lot of use cases
2 Remove foundations
- Delete
src/test-utilities/legacy.tsx
- Remove any mentions of
enzyme
intests/setup
and anywhere else in the codebase - Remove
enzyme
/enzyme-adapter-react-16
dependencies from package.json
kyledurand
Metadata
Metadata
Assignees
Labels
BugSomething is broken and not working as intended in the system.Something is broken and not working as intended in the system.