Skip to content

Conversation

@Willdotwhite
Copy link

@Willdotwhite Willdotwhite commented Dec 16, 2025

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.

By using the react-scripts eject command, we can remove the (very) deprecated react-scripts package and corral the project dependancies into better view.

Unless #145 , this PR does not change any of the underlying function of the repo. Exactly the same packages are in use, other than bumped to the minimum stable level for us to pass npm audit. Whether this approach is better/worse than 145 is up for discussion.

Ethos

Make as few changes as possible to get the app to a security-stable place. Change no dependencies at all. Make as few changes to the source/test files as possible.

How

  • Run npm run eject
  • Migrate packages which fail audit and adjust to until npm start, npm build and npm test all run stably

Outcome

Before

$ npm audit
38 vulnerabilities (6 low, 14 moderate, 17 high, 1 critical)

After

$ npm audit
found 0 vulnerabilities

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

PASS src/dataFetcher/index.test.jsx
PASS src/components/Scorecard/Scorecard.test.jsx
PASS src/components/PartyLinks/PartyLinks.test.jsx
FAIL src/components/Scoreboard.test.jsx
● fetches results again when refresh button clicked

expect(jest.fn()).toBeCalledTimes(expected)

Expected number of calls: 2
Received number of calls: 1

  87 |   fireEvent.click(refreshButton);
  88 |
> 89 |   expect(dataFetcher).toBeCalledTimes(2);
     |                       ^
  90 |   await waitFor(() => {
  91 |     const votesAfterRefresh = screen.getByText(/12345/i);
  92 |     expect(votesAfterRefresh).toBeInTheDocument();

  at Object.toBeCalledTimes (src/components/Scoreboard.test.jsx:89:23)

Test Suites: 1 failed, 3 passed, 4 total
Tests: 1 failed, 9 passed, 10 total
Snapshots: 0 total

</details>

@Willdotwhite Willdotwhite force-pushed the chore/eject-and-update branch from d38fe17 to 99eef61 Compare December 16, 2025 14:49
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

Successfully merging this pull request may close these issues.

2 participants