mirror of
https://github.com/PR0M3TH3AN/bitvid.git
synced 2026-10-27 07:52:24 +00:00
fix(test): resolve hangs in multiple unit tests and harden runner
Co-authored-by: PR0M3TH3AN <[email protected]>
This commit is contained in:
1 parent
42a18fa784
commit
be43c266e0
3 files changed
+11
No files matched your search
@@ -26,6 +26,13 @@
|
|||||||
4. **`tests/nostr-send-direct-message.test.mjs`**: Susceptible to similar hangs.
|
4. **`tests/nostr-send-direct-message.test.mjs`**: Susceptible to similar hangs.
|
||||||
* **Fix Applied**: Added `after(() => setTimeout(() => process.exit(0), 100))` to force exit.
|
* **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
|
### Browserslist Warning
|
||||||
|
|
||||||
The build command emitted: `Browserslist: caniuse-lite is outdated`.
|
The build command emitted: `Browserslist: caniuse-lite is outdated`.
|
||||||
|
|||||||
@@ -178,6 +178,8 @@ async function run() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
console.log("\n✔ All unit tests passed");
|
console.log("\n✔ All unit tests passed");
|
||||||
|
// Force exit to ensure we don't hang on lingering handles/timers
|
||||||
|
process.exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -67,6 +67,8 @@ test.after(() => {
|
|||||||
} else {
|
} else {
|
||||||
globalThis.NostrTools = originalGlobalNostrTools;
|
globalThis.NostrTools = originalGlobalNostrTools;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
setTimeout(() => process.exit(0), 100);
|
||||||
});
|
});
|
||||||
|
|
||||||
function createServiceWithAccessControl() {
|
function createServiceWithAccessControl() {
|
||||||
|
|||||||
Reference in new issue
Block a user