Skip to content

chore: rewrite test progress watcher in JavaScript - #278

Merged
williscool merged 2 commits into
masterfrom
chore/watch_test_progress_js
Sep 21, 2026
Merged

williscool merged 2 commits into
masterfrom
chore/watch_test_progress_js

Conversation

@williscool

Copy link
Copy Markdown
Owner

Follow-up to the review comment on #277: the test-progress watcher was bash wrapping a Python heredoc, which added a third scripting language to a repo that already has first-class JS support.

Changes

scripts/watch_test_progress.js Node rewrite, matching existing scripts/*.js conventions (shebang, JSDoc header, CommonJS)
scripts/watch_test_progress.sh deleted
package.json yarn watch:tests, plus fast-xml-parser as a devDependency
docs/build/wsl_unison_environment.md updated invocation

On the dependency

fast-xml-parser already resolved here, but only transitively via @react-native-community/cli. Depending on that would have worked today and broken silently if the dep tree shifted, so it is now declared explicitly. devDependencies since it is only used by a dev script and never ships.

What it does

Gradle's Test task prints nothing per-test, so a long run looks identical to a hung one. The testLogging block added in #277 covers new runs; this covers a build that is already in flight, by reading the JUnit XML as each class lands:

[02:11:03] classes=2 tests=28
           CalendarIntentsRobolectricTest: 9 tests, 21.256s
           EventIdentityStorageRobolectricTest: 19 tests, 2.509s

Verification

Compared against the bash version on the same results directory — identical output. That comparison was worth doing: the first JS attempt read the leading <?xml ...?> declaration instead of the <testsuite element and reported classes=0 where bash reported classes=2.

Also checked:

  • missing results directory → exits 1 with a clear message
  • failures and errors aggregate together (2 + 1 = FAILURES=3)
  • a half-written file is skipped rather than crashing the poll — Gradle writes these while the build runs, so partial reads are normal, not exceptional

Not part of the build or CI, so the meaningful check here is that yarn.lock resolves cleanly on a fresh install.

🤖 Generated with Claude Code

https://claude.ai/code/session_01N34fouw76cNkoFVg6V3j4Z

williscool and others added 2 commits September 21, 2026 06:12
Per review on #277: the bash version embedded a Python heredoc, adding
a third scripting language when this repo already has first-class JS
support. Rewritten as node, matching the existing scripts/*.js
conventions (shebang, JSDoc header, CommonJS) and wired up as
`yarn watch:tests`.

Parses the JUnit XML attributes with a regex rather than adding a
parser dependency -- fast-xml-parser resolves here but only
transitively, so depending on it could break silently if the dep tree
shifts. Only a few root-element attributes are needed.

Verified against the bash version on the same results directory:
identical output. Also checked the missing-directory path (exits 1),
repeated polling, and failure aggregation (failures + errors).

One bug caught while comparing: the first JS attempt read the leading
`<?xml ...?>` declaration instead of the `<testsuite` element and
reported 0 classes where bash reported 2.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01N34fouw76cNkoFVg6V3j4Z
Per review: rather than working around the missing dependency with a
regex, declare it. fast-xml-parser was already resolving here, but only
transitively via @react-native-community/cli -- depending on that would
have worked today and could break silently if the dep tree shifted.

Now an explicit devDependency (it is only used by a dev script, never
shipped), and readSuite parses properly instead of string-matching
attributes off the root element.

Verified output is unchanged against the same results directory, that
failures and errors still aggregate, and that a half-written file is
skipped rather than crashing the poll -- Gradle writes these while the
build runs, so partial reads are normal rather than exceptional.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01N34fouw76cNkoFVg6V3j4Z
@github-actions

Copy link
Copy Markdown

Build artifacts for PR #278 (commit 719f440) are available:

You can download these artifacts from the "Artifacts" section of the workflow run.

@github-actions

Copy link
Copy Markdown

Code Coverage Report

Overall Project 27.42% ❌

There is no coverage information present for the Files changed

@github-actions

Copy link
Copy Markdown

📊 Code Coverage Summary

Coverage Type Coverage
Overall 27.42
Changed Files 100

View detailed coverage report

@williscool
williscool merged commit b9f6625 into master Sep 21, 2026
13 of 16 checks passed
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.

1 participant