Skip to content

Docs: Test strategy unclear beyond a single CRA test - #7

Open
moxie-docs[bot] wants to merge 1 commit into
mainfrom
moxie/docs-2026-07-31-d5aa0f
Open

Docs: Test strategy unclear beyond a single CRA test#7
moxie-docs[bot] wants to merge 1 commit into
mainfrom
moxie/docs-2026-07-31-d5aa0f

Conversation

@moxie-docs

@moxie-docs moxie-docs Bot commented Jul 31, 2026

Copy link
Copy Markdown

Clarifies the CRA-based frontend testing setup and conventions so maintainers can run, discover, and extend tests confidently, including specifics of the existing App.test.js smoke test

What these docs cover

  • Tests run via react-scripts test (Jest under CRA) with watch mode by default in interactive terminals
  • CRA/Jest auto-discovers *.test.js(x) and *.spec.js(x) files anywhere under frontend/src/
  • Testing stack includes @testing-library/react for rendering/queries, @testing-library/jest-dom for DOM matchers, and @testing-library/user-event for interactions
  • npm test starts watch mode; setting CI=true runs tests once and exits
  • App.test.js renders , queries screen.getByText(/learn react/i), and asserts toBeInTheDocument
  • Gotchas called out: tests must live under src/ for discovery, and the current text-coupled assertion is brittle if UI copy changes

How to review

  • Verify frontend/package.json scripts.test is exactly react-scripts test
  • Check frontend/package.json lists @testing-library/jest-dom ^5.17.0, @testing-library/react ^13.4.0, and @testing-library/user-event ^13.5.0 as test dependencies
  • Confirm frontend/package.json ESLint config extends react-app/jest
  • Confirm frontend/src/App.test.js imports App from ./App, calls render(App), uses screen.getByText(/learn react/i), and asserts expect(...).toBeInTheDocument()

Documentation updated

Referenced sources

🦊 Something look off? Tag @moxie-docs in a comment with your correction - I can update a single doc, regenerate all of them, or save it as a lasting rule for future PRs.

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.

0 participants