Modernise UI:JS task dependencies #145
Draft
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Why
The previous iteration of this project used create-react-app and react-scripts, which anchored the dependencies of this project to now-deprecated packages that are hard to update. Instead of incrementally improving packages where possible, this change has effectively rebased this project onto a modern ReactJS stack to give us more headroom in staying secure until dependencies reach EOL.
Ethos
Change as little of the source/test files as possible; therefore, most of the changes are JS setup/config files that I would expect a candidate to ignore.
This approach has led to more dependencies, but for the most part the tooling is using them with default behaviour, so hopefully maintaining them will not be too painful 🤞🏻
How
npm create vite@latest . -- --template reactin place.jsto.jsxOutcome
Before
After
Tests
All tests pass but one, which I believe intentionally fails (as there's no logic to refetch the data in the UI)
Verbose test output
``` $ npm test -- --verboseFAIL src/components/Scoreboard.test.jsx
✓ renders Results (67 ms)
✓ renders error state (9 ms)
✕ fetches results again when refresh button clicked (18 ms)
● fetches results again when refresh button clicked
PASS src/components/Scorecard/Scorecard.test.jsx
✓ renders results (4 ms)
✓ renders No Results if there are no results (1 ms)
PASS src/components/PartyLinks/PartyLinks.test.jsx
✓ renders party links as a list (3 ms)
✓ renders all the party links (2 ms)
✓ renders a party link with the correct text and href (2 ms)
PASS src/dataFetcher/index.test.jsx
✓ returns an Object (1 ms)
✓ response contains a result array
Test Suites: 1 failed, 3 passed, 4 total
Tests: 1 failed, 9 passed, 10 total
Snapshots: 0 total
Time: 0.889 s, estimated 1 s
Ran all test suites.