Skip to content

Extract Shared Test Harness Module from 9 Test Files#85

Merged
davida-ps merged 3 commits intomainfrom
auto-claude/002-extract-shared-test-harness-module-from-9-test-fil
Feb 27, 2026
Merged

Extract Shared Test Harness Module from 9 Test Files#85
davida-ps merged 3 commits intomainfrom
auto-claude/002-extract-shared-test-harness-module-from-9-test-fil

Conversation

@davida-ps
Copy link
Collaborator

@davida-ps davida-ps commented Feb 27, 2026

User description

Opener Type

  • Agent (automated)
  • Human

Summary

Extracted shared test harness module to eliminate code duplication across 9 test files. Created skills/clawsec-suite/test/lib/test_harness.mjs providing centralized pass()/fail() reporting, counter tracking, summary reporting with process.exit, Ed25519 key generation, and payload signing utilities.

Changes Made

  • Created new shared test harness module at skills/clawsec-suite/test/lib/test_harness.mjs
  • Updated 9 test files to import and use centralized test utilities instead of duplicate implementations
  • Added .gitkeep file to establish test/lib/ directory
  • Reduced code duplication (~20-30 lines per test file)

Related Issues


Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update
  • Security incident (please open a Security Incident Report issue instead of a PR)

Testing

Test harness module extracted from existing test implementations that are already in use. All 9 affected test files maintain identical test logic and reporting behavior through import of shared utilities.

Checklist

  • My code follows the project's style guidelines
  • I have performed a self-review of my changes
  • I have added tests that prove my fix/feature works
  • New and existing tests pass locally
  • PR is small and focused (< 400 lines)

Generated description

Below is a concise technical summary of the changes proposed in this PR:
Refactor the test suite by centralizing common utilities into a new test_harness.mjs module, eliminating code duplication across nine test files in clawsec-suite and openclaw-audit-watchdog. Additionally, update development environment configurations and dependencies to improve project maintainability and security.

TopicDetails
Dev Environment Updates Update development environment configurations and dependencies to enhance project maintainability and security. This includes adding new ignore patterns for ESLint and Git, and upgrading various ESLint and TypeScript-related packages to their latest versions.
Modified files (4)
  • .gitignore
  • eslint.config.js
  • package-lock.json
  • package.json
Latest Contributors(2)
UserCommitDate
[email protected]Codex-fix-poll-nvd-pr-...February 27, 2026
[email protected]fix-portability-harden...February 25, 2026
Test Infrastructure Centralize and standardize test utilities across the clawsec-suite and openclaw-audit-watchdog by extracting common functions like test reporting, temporary directory management, cryptographic key generation, and environment variable isolation into a new test_harness.mjs module, thereby eliminating code duplication and improving test suite maintainability.
Modified files (11)
  • skills/clawsec-suite/test/advisory_application_scope.test.mjs
  • skills/clawsec-suite/test/advisory_suppression.test.mjs
  • skills/clawsec-suite/test/feed_verification.test.mjs
  • skills/clawsec-suite/test/fuzz_properties.test.mjs
  • skills/clawsec-suite/test/guarded_install.test.mjs
  • skills/clawsec-suite/test/lib/.gitkeep
  • skills/clawsec-suite/test/lib/test_harness.mjs
  • skills/clawsec-suite/test/path_resolution.test.mjs
  • skills/clawsec-suite/test/skill_catalog_discovery.test.mjs
  • skills/openclaw-audit-watchdog/test/render_report_suppression.test.mjs
  • skills/openclaw-audit-watchdog/test/suppression_config.test.mjs
Latest Contributors(2)
UserCommitDate
[email protected]fix-portability-harden...February 25, 2026
[email protected]Security-Audit-Suppres...February 16, 2026
This pull request is reviewed by Baz. Review like a pro on (Baz).

davida-ps and others added 3 commits February 27, 2026 08:26
Extract duplicated test utilities into a reusable test_harness.mjs module
to eliminate ~200-250 lines of boilerplate code across test files.

Changes:
- Create skills/clawsec-suite/test/lib/test_harness.mjs with:
  - Test reporting: pass(), fail(), report(), exitWithResults()
  - Crypto utilities: generateEd25519KeyPair(), signPayload()
  - Temp directory: createTempDir() with cleanup
  - Environment helpers: withEnv() for isolated env vars
  - Test runner factory: createTestRunner() for isolated counters

- Refactor 9 test files to use shared harness:
  - feed_verification.test.mjs
  - guarded_install.test.mjs
  - skill_catalog_discovery.test.mjs
  - advisory_suppression.test.mjs
  - advisory_application_scope.test.mjs
  - path_resolution.test.mjs
  - fuzz_properties.test.mjs
  - suppression_config.test.mjs
  - render_report_suppression.test.mjs

Benefits:
- Single source of truth for test utilities
- Consistent test reporting across all files
- Easier to add new test files
- Reduced maintenance burden

Verification:
- All 80 tests pass (15+8+3+15+4+6+1+17+11)
- Zero ESLint warnings
- No behavior changes - only code deduplication
- Cross-skill module sharing works (openclaw-audit-watchdog → clawsec-suite)

Co-Authored-By: Claude Sonnet 4.5 <[email protected]>
…ct-shared-test-harness-module-from-9-test-fil
…ties

Bump minimatch from 10.2.1 to 10.2.4 in overrides to fix 10 high-severity
ReDoS vulnerabilities (GHSA-7r86-cg39-jmmj, GHSA-23c5-xmqv-rm74).
Also add .venv/ to ESLint ignores to prevent linting Python venv files.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
@davida-ps davida-ps merged commit c9a66d5 into main Feb 27, 2026
13 checks passed
@davida-ps davida-ps deleted the auto-claude/002-extract-shared-test-harness-module-from-9-test-fil branch February 27, 2026 07:20
davida-ps added a commit that referenced this pull request Feb 27, 2026
Merge origin/main into feature branch to incorporate latest changes:
- Extract Shared Test Harness Module (#85)
- Fix poll-nvd PR auth (#86)

Resolved conflicts in .gitignore (Auto Claude entries).

QA Fix Session: 0

Co-Authored-By: Claude Sonnet 4.5 <[email protected]>
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