Convert stress-test scripts to mocha describe/it format#307
Conversation
…dule Agent-Logs-Url: https://github.com/albe/node-event-storage/sessions/6e0a553c-b9bd-46bb-816a-a95f35c6d4d9 Co-authored-by: albe <4259532+albe@users.noreply.github.com>
|
@copilot why is running the memory and stress tests through mocha a good approach? Doesn't mocha itself add some overhead and fragility to the test? |
The concern is valid and worth addressing for each test separately: Crash-safety ( Memory (
On fragility: the spec files use only |
|
@copilot should the same then be applied to all benchmark test scripts? |
No — the The stress tests make correctness assertions (memory growth is sub-linear, crash recovery succeeds), which map naturally to mocha's pass/fail model. The benchmark scripts use the
The benchmarks are already well-structured: they're run via |
The stress-test scripts were standalone Node.js executables using
process.exit()for pass/fail signaling and lacked"type": "module"in theirpackage.json, causing aMODULE_TYPELESS_PACKAGE_JSONwarning at runtime.Changes
stress-test/memory.spec.js(replacesmemory.js) — Rewrites the three-phase memory test as a mocha spec:it()block with a descriptive nameErrorinstead of settingprocess.exitCodeasync/awaitused throughoutbefore/afterhooksstress-test/stress.spec.js(new) — Wraps the crash-safety orchestration script (run.sh) in a singleit()that spawns it as a child process and fails the test on non-zero exitstress-test/package.json— Adds"type": "module"(eliminates the Node.js warning) and a"test"script pointing to both spec filesRun via the root's mocha: