Skip to content

Enable Node.js test runner and add characterization tests - #2

Merged
monitorian merged 2 commits into
mainfrom
codex/analyze-repository-for-safe-refactoring-plan
May 10, 2026
Merged

monitorian merged 2 commits into
mainfrom
codex/analyze-repository-for-safe-refactoring-plan

Conversation

@monitorian

@monitorian monitorian commented May 9, 2026 •

Copy link
Copy Markdown
Owner

Motivation

  • Improve automated test coverage for discovery, status mapping, and formatting logic to detect regressions in output stability and value mapping.
  • Make the repository testable with the built-in Node.js test runner to simplify CI and local validation.

Description

  • Update package.json test script to include node --test so the Node.js built-in test runner is executed as part of npm test.
  • Add test/characterization.test.js which contains characterization tests for extractV2hObjectIds, buildStatus, formatDiscoveredDevices, and formatStatus.
  • Include helpers in the tests to strip ANSI sequences and normalize dynamic values like IP addresses and object IDs to ensure stable assertions.
  • Validate mapping behavior, fallback handling, table contents, and stable label ordering in the formatted output.

Testing

  • Added automated tests under test/characterization.test.js which are executed by running node --test or npm test.

  • Ran node --test (via npm test which now invokes node --test) against the modified code and the new tests passed.

Summary(変更概要)

Node.js test runner を有効化し、fixtureベースの characterization tests を追加する。

CI Checks(CI確認)

  • build
  • test
  • lint
  • typecheck
  • safety check

Hardware Impact(実機制御への影響)

  • No hardware behavior changes
  • Hardware behavior changed
  • No timing changes
  • No retry changes
  • No ECHONET Lite flow changes
  • No scheduler/systemd changes

Real Hardware Verification(実機確認)

  • Not required
  • Required
  • Completed

Reason(理由):

  • fixtureベースのテスト追加のみで、実機通信や制御ロジックは変更していないため。

Commands tested(確認コマンド):

  • npm test
  • npm run safety:check

Result(結果):

  • テストと safety check が通ることを確認。

Human Review Points(人間確認が必要な点)

  • 追加した characterization tests が、実機依存値ではなく fixture / normalized values に対する検証になっているか。
  • 実行時の ECHONET Lite 通信フローや制御タイミングを変更していないか。

CI Cannot Verify(CIでは確認できない点)

  • 実機との ECHONET Lite 通信、実機応答、実環境でのタイミング安定性はCIでは確認できない。

@monitorian
monitorian merged commit 3cb9851 into main May 10, 2026
3 of 4 checks passed
@monitorian
monitorian deleted the codex/analyze-repository-for-safe-refactoring-plan branch May 10, 2026 01:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant