Skip to content

test(react): restore Jest and add jest-axe accessibility tests - #1381

Open
Akay-74 wants to merge 2 commits into
RocketChat:developfrom
Akay-74:test/jest-axe-a11y
Open

Akay-74 wants to merge 2 commits into
RocketChat:developfrom
Akay-74:test/jest-axe-a11y

Conversation

@Akay-74

@Akay-74 Akay-74 commented Oct 10, 2026 •

Copy link
Copy Markdown

Restore Jest and add jest-axe baseline

Acceptance Criteria fulfillment

  • Jest runs in packages/react (yarn test)
  • jest-axe added and toHaveNoViolations registered
  • Baseline axe tests, starting with TypingUsers (idle and active states)
  • Baseline tests for ChatInput, MessageList and Sidebar (follow-up, they need store and DDP mocks)
  • Run tests in CI (build-and-lint.yml)

Refs #1219

What was broken

Jest couldn't run in packages/react: no test script, src/index.test.js imported a removed RCComponent export, the Babel config emitted ESM, and @testing-library/react 12 doesn't support React 19.

Changes

  • test script; Jest 29, jsdom, Testing Library 16, jest-axe
  • jest.config.js / jest.setup.js: jsdom env, axe matcher, stubs for swiper, react-syntax-highlighter ESM and MessageChannel (Node's real one keeps Jest open)
  • Babel emits CommonJS only when NODE_ENV=test, so the production build is unchanged
  • Replaced the stale index test with an export smoke test
  • TypingUsers.a11y.test.js

yarn.lock grows by about 1,300 lines from the Jest upgrade.

Video/Screenshots

N/A, test tooling only.

PR Test Details

cd packages/react && yarn test gives 2 suites, 3 tests passing in about 2s. I also checked that axe fails on an unlabeled <button>, so a green run is meaningful.

Jest could not run in packages/react: there was no test script, the
only test imported a removed RCComponent export, the Babel config
emitted ESM, and @testing-library/react 12 does not support React 19.

- add a test script and upgrade to Jest 29, Testing Library 16 and
  jest-axe
- add jest config and setup (jsdom, axe matcher, stubs for swiper,
  react-syntax-highlighter ESM and MessageChannel)
- emit CommonJS from Babel only when NODE_ENV=test
- replace the stale index test with an export smoke test
- add axe baseline tests for TypingUsers

Refs RocketChat#1219

Signed-off-by: Akay-74 <Akay-74@users.noreply.github.com>
@CLAassistant

CLAassistant commented Oct 10, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

Runs yarn workspace @embeddedchat/react test before the build so the
Jest and jest-axe tests run on every PR.

Signed-off-by: Akay-74 <Akay-74@users.noreply.github.com>
@Akay-74
Akay-74 marked this pull request as ready for review October 10, 2026 11:56

This branch has not been deployed

No deployments
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