kentcdodds / kentcdodds/react-testing-library-examples
broken with history@latest
- Dominant language
- HTML
- Stars
- 409
- Forks
- 100
- PR merge metrics
- No merged PRs in 30d
Description
I found that `react-router.js` test is broken with latest version of `history` (currently @ `5.0.0`):
```sh
$ yarn upgrade history@latest
success Saved lockfile.
success Saved 1 new dependency.
info Direct dependencies
└─ history@5.0.0
info All dependencies
└─ history@5.0.0
✨ Done in 33.73s.
$ yarn test
$ jest
PASS sandbox src/__tests__/react-redux.js (6.666s)
PASS sandbox src/__tests__/portals.js (6.842s)
FAIL sandbox src/__tests__/react-router.js (6.952s)
● full app rendering/navigating
expect(received).toMatch(expected)
Expected substring: "You are on the about page"
Received string: "
52 | fireEvent.click(screen.getByText(/about/i), leftClick)
53 | // normally I'd use a data-testid, but just wanted to show this is also possible
> 54 | expect(container.innerHTML).toMatch('You are on the about page')
| ^
55 | })
56 |
57 | test('landing on a bad page', () => {
at Object. (../src/__tests__/react-router.js:54:31)
PASS local src/__local_tests__/mock.react-router.js
PASS local src/__local_tests__/async-with-mock.js
PASS local src/__local_tests__/component-did-catch.js
PASS sandbox src/__tests__/i18next.js
PASS sandbox src/__tests__/async.js
PASS sandbox src/__tests__/on-change.js
PASS local src/__local_tests__/shallow.react-transition-group.js
PASS local src/__local_tests__/mock.react-transition-group.js
PASS sandbox src/__tests__/window-resize.js
PASS sandbox src/__tests__/react-lazy-and-suspense.js
PASS sandbox src/__tests__/upload-file.js
PASS sandbox src/__tests__/update-props.js
PASS sandbox src/__tests__/react-context.js
Test Suites: 1 failed, 1 skipped, 15 passed, 16 of 17 total
Tests: 1 failed, 1 skipped, 25 passed, 27 total
Snapshots: 0 total
Time: 19.537s
Ran all test suites in 2 projects.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
```
Contributor guide
No contributing guide indexed for this repository
Research direction
Run `yarn test` and inspect `src/__tests__/react-router.js`, especially the full app rendering/navigating case that fails after upgrading `history` to 5.0.0. Trace the failing navigation behavior and verify that the complete test suite passes with the intended compatibility fix.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, react
- Domain
- frontend, testing-qa
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100