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

broken with history@latest #15

Open
abernier opened this issue Jun 28, 2020 · 1 comment
Open

broken with history@latest #15

abernier opened this issue Jun 28, 2020 · 1 comment

Comments

@abernier
Copy link

abernier commented Jun 28, 2020

I found that react-router.js test is broken with latest version of history (currently @ 5.0.0):

$ 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:    "<div><a href=\"/\">Home</a><a href=\"/about\">About</a><div>No match</div><div data-testid=\"location-display\"></div></div>"

      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.<anonymous> (../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.
@kentcdodds
Copy link
Owner

I think that the latest version of react-router doesn't work with the latest version of history. Nothing to do with Testing Library.

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

2 participants