Unit-test the shipped frontend JavaScript with standard JS tooling (vitest)
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 35/100
- Issue type
- Feature
- Clarity
- Mostly clear
- Activity status
- Active
- Tech stack
- github-actions, javascript, node.js, python
Research direction
Read the pending work and related issues #7609 and #7610 first: the suite depends on which branch lands first and must be reconciled into one package.json, lockfile, and CI job. The issue names tests/js/, reflex_base/frontend/tests/, vitest.config.js, AGENTS.md, and unit_tests.yml as the relevant entry points. Done means Vitest with jsdom tests the shipped JavaScript, runs through a gated CI job, and is documented; the existing runtime scripts are a follow-up.
Written by the indexing model from the issue text.
Description
Problem
The JavaScript Reflex ships to every app (state.js, react-theme.js, upload.js, client state, the helpers and components under .templates/web/utils/) has no test suite of its own. Its behavior is only reachable through compiled output: Python unit tests can assert on generated source but not on runtime behavior, and Playwright integration tests are slow and indirect for things like provider teardown, SSR-versus-client branches, subscription bookkeeping, reconnect backoff or event-queue ordering. The two existing runtime checks (tests/units/compiler/state_js.test.mjs, tests/units/reflex_base/client_event_queue_runtime.mjs) are bespoke node scripts driven from pytest.
Proposal
Test the shipped JS with standard tooling: vitest + jsdom, with its own package.json and a committed package-lock.json, installed with npm ci and run as a js-unit-tests job in unit_tests.yml that blocks merges through unit-tests-gate.
- Tests must not live inside the template tree that
reflex initcopies verbatim into a user's.web. While the runtime is still a template tree they live intests/js/and resolve$/...through a vitest alias; once the runtime ships as a package (#7609) they move into the package atreflex_base/frontend/tests/. $/utils/statehas to be stubbed today because the real module imports socket.io, react-router and the per-app generatedutils/context.js. Decoupling the runtime from generated artifacts (part of #7609) makesstate.jsitself unit-testable.- Where JS and Python share a constant (for example the client-state registry key in
constants/state.py, or the_downloadpayload matcher instate.jsversus the Var's_js_expr), a test asserts the two definitions agree so they cannot drift. - Document the suite, and when to reach for it versus Playwright, in
AGENTS.md(npm --prefix tests/js ci && npm --prefix tests/js test). - New JS test files are formatted with biome under pre-commit; codespell skips committed lockfiles.
Pending work
- #6936 (ClientStateVar refactor, #7610) introduces
tests/js/:vitest.config.js,client_state.test.js, thejs-unit-testsCI job and its gate wiring, and theAGENTS.mdsection. - The npm package branch for #7609 adds
reflex_base/frontend/tests/withstate.test.js,runtime.test.jsandhelpers.test.js, and makesstate.jsimportable in tests. - Land the suite with whichever of the two merges first, then reconcile the other so there is one
package.json/lockfile and one CI job. - Follow-up: fold the existing
.mjsruntime checks into the vitest suite so there is a single JS test entry point.
Related
- #7609 installable npm package
- #7610 ClientStateVar refactor (#6936)
- Dominant language
- Python
- Stars
- 29k
- Forks
- 1.8k
- Avg merge
- 2d 22h
- Merged PRs (30d)
- 143
Getting set up
Starts the project's dev container in your browser, under your own GitHub account.
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from reflex-dev/reflex
-
Operations on a list[T] | None var throw when the value is NonePossibly taken @masenf claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
reflex-dev/reflex#7826 · 1 comment ·
Maintainers usually reply within 1 day
-
A dev run stopped before its backend loads leaves .web/nocompile, so the next run or export skips the compilePossibly taken A pull request linked to this issue is open or already merged. Open
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
reflex-dev/reflex#7825 · 1 comment ·
Maintainers usually reply within 1 day
-
PropsBase nested serialization applies parent include/exclude filters to child fieldsPossibly taken @harsh21234i claimed this 1 day ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
reflex-dev/reflex#7787 · 1 comment ·
Maintainers usually reply within 1 day
-
OTel: add trace_flags to JSON log records so unsampled trace ids are recognizablePossibly taken @ShaanGS claimed this 7 days ago. Openenhancement
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
reflex-dev/reflex#7729 · 1 comment ·
Maintainers usually reply within 1 day
-
0.9.12 changelog follow-ups: the #7132 "_get_was_touched" entry describes unreachable behaviour, #7115's hasattr/getattr change is undocumented, #7131's wordingMay be free again A pull request for this issue was closed without being merged. Open
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
reflex-dev/reflex#7260 · 2 comments ·
Maintainers usually reply within 1 day
All issues in reflex-dev/reflex
Similar issues
-
release
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
MichaelYcJo/SpecSeal#1535 ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
valentinfrlch/ha-llmvision#769 ·
Maintainers usually reply within 1 day
-
bug
Difficulty 1/5 Under an hour Newbie friendliness 75/100
daniel-ospina/tortoise#11937 · 1 comment ·
Maintainers usually reply within 1 day
-
good first issue help wanted python up-for-grabs
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
andrewsiah/agentswarm-data-tasks#238 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
cadence-workflow/cadence-ai-samples#175 ·
Maintainers usually reply within 1 day