perf: reduce memory usage upon running server tests (#3949)

* perf: reduce memory usage upon running server tests

* perf: plug leaks in server/routes

* perf: plug leaks in server/scripts

* perf: plug leaks in server/policies

* perf: plug leaks in server/models

* perf: plug leaks in server/middlewares

* perf: plug leaks in server/commands

* fix: missing await on db.flush

* perf: plug leaks in server/queues

* chore: remove unused legacy funcs

* fix: await on db.flush

* perf: await on GC to run in between tests

* fix: remove db refs

* fix: revert embeds

* perf: plug leaks in shared/i18n
This commit is contained in:
Apoorv Mishra
2022-08-11 21:39:17 +05:30
committed by GitHub
parent 8e1f42a9cb
commit 0c51bfb899
68 changed files with 463 additions and 178 deletions

View File

@@ -1,9 +1,12 @@
import { buildUser, buildCollection } from "@server/test/factories";
import { flushdb, getTestServer } from "@server/test/support";
import { getTestDatabase, getTestServer } from "@server/test/support";
const db = getTestDatabase();
const server = getTestServer();
beforeEach(() => flushdb());
afterAll(server.disconnect);
beforeEach(db.flush);
describe("auth/redirect", () => {
it("should redirect to home", async () => {

View File

@@ -3,11 +3,14 @@ import SigninEmail from "@server/emails/templates/SigninEmail";
import WelcomeEmail from "@server/emails/templates/WelcomeEmail";
import env from "@server/env";
import { buildUser, buildGuestUser, buildTeam } from "@server/test/factories";
import { flushdb, getTestServer } from "@server/test/support";
import { getTestDatabase, getTestServer } from "@server/test/support";
const db = getTestDatabase();
const server = getTestServer();
beforeEach(() => flushdb());
afterAll(server.disconnect);
beforeEach(db.flush);
describe("email", () => {
it("should require email param", async () => {