fix(test): resolve hangs in multiple unit tests and harden runner

Co-authored-by: PR0M3TH3AN <[email protected]>
This commit is contained in:
google-labs-jules[bot]andPR0M3TH3AN committed 2026-01-31 10:33:50 +00:00
1 parent 42a18fa784
commit be43c266e0
3 files changed
+11

No files matched your search

+7
View File
@@ -26,6 +26,13 @@
4. **`tests/nostr-send-direct-message.test.mjs`**: Susceptible to similar hangs.
* **Fix Applied**: Added `after(() => setTimeout(() => process.exit(0), 100))` to force exit.
5. **`tests/nostr-service-access-control.test.mjs`**: Caused hangs due to mock tool cleanup.
* **Fix Applied**: Added `setTimeout(() => process.exit(0), 100)` in `after` hook.
### Test Runner Robustness
* **`scripts/run-unit-tests.mjs`**: Updated to explicitly call `process.exit(0)` upon successful completion of all tests. This acts as a global safeguard against lingering open handles (e.g., from `nostr-tools` relays or timers) causing CI timeouts.
### Browserslist Warning
The build command emitted: `Browserslist: caniuse-lite is outdated`.
+2
View File
@@ -178,6 +178,8 @@ async function run() {
}
console.log("\n✔ All unit tests passed");
// Force exit to ensure we don't hang on lingering handles/timers
process.exit(0);
}
try {
@@ -67,6 +67,8 @@ test.after(() => {
} else {
globalThis.NostrTools = originalGlobalNostrTools;
}
setTimeout(() => process.exit(0), 100);
});
function createServiceWithAccessControl() {