diff --git a/tests/local.ts b/tests/local.ts index 41f77367a..85e15eef6 100644 --- a/tests/local.ts +++ b/tests/local.ts @@ -6,4 +6,17 @@ import "./util/validate_length.ts"; import "./util/loop_object.ts"; // Final cleanup -import "./stop_sweepers.ts"; + +import { cache } from "../src/cache.ts"; +import { delay } from "../src/util/utils.ts"; +if (import.meta.main) { + // clear all the sweeper intervals + for (const c of Object.values(cache)) { + if (!(c instanceof Map)) continue; + + c.stopSweeper(); + console.log("Cleaned"); + } + + await delay(3000); +} diff --git a/tests/mod.ts b/tests/mod.ts index e0dba20da..13c4dc1a2 100644 --- a/tests/mod.ts +++ b/tests/mod.ts @@ -74,4 +74,17 @@ import "./discoveries/valid_discovery_term.ts"; // Final cleanup import "./guilds/delete_guild.ts"; import "./ws/ws_close.ts"; -import "./stop_sweepers.ts"; + +import { cache } from "../src/cache.ts"; +import { delay } from "../src/util/utils.ts"; +if (import.meta.main) { + // clear all the sweeper intervals + for (const c of Object.values(cache)) { + if (!(c instanceof Map)) continue; + + c.stopSweeper(); + console.log("Cleaned"); + } + + await delay(3000); +} diff --git a/tests/stop_sweepers.ts b/tests/stop_sweepers.ts deleted file mode 100644 index 2ecf30762..000000000 --- a/tests/stop_sweepers.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { cache } from "../src/cache.ts"; - -// Exit the Deno process once all tests are done. -Deno.test({ - name: "[chache] Stop all sweepers manually.", - fn() { - // clear all the sweeper intervals - for (const c of Object.values(cache)) { - if (!(c instanceof Map)) continue; - - c.stopSweeper(); - } - }, -});