kentcdodds / kentcdodds/react-testing-library-examples

broken with history@latest

Aperta
#15 1 commento 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
HTML
Stelle
409
Fork
100
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

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: "

HomeAbout
No match
"

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.
```

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Direzione di ricerca

Esegui `yarn test` e ispeziona `src/__tests__/react-router.js`, in particolare il caso di rendering/navigazione dell'app completa che non riesce dopo l'aggiornamento di `history` alla versione 5.0.0. Traccia il comportamento di navigazione che fallisce e verifica che l'intera suite di test passi con la correzione di compatibilità prevista.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
javascript, react
Ambito
frontend, testing-qa
Tipo di issue
Bug
Difficoltà
3/5
Tempo stimato
1-2 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
42/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.