Browse Source

refactor: exclude all logs to console by default when running tests

Kristian Vos 8 tháng trước cách đây
mục cha
commit
1f23fd7794
1 tập tin đã thay đổi với 22 bổ sung4 xóa
  1. 22 4
      backend/src/tests/support/setup.ts

+ 22 - 4
backend/src/tests/support/setup.ts

@@ -1,12 +1,30 @@
 import chai from "chai";
 import chaiAsPromised from "chai-as-promised";
-import sinon from "sinon";
 import sinonChai from "sinon-chai";
+import LogBook from "@/LogBook";
 
 chai.should();
 chai.use(sinonChai);
 chai.use(chaiAsPromised);
 
-afterEach(async function () {
-	sinon.reset();
-});
+if (typeof beforeEach !== "undefined")
+	beforeEach(async function () {
+		await LogBook.updateOutput("console", "exclude", "set", [
+			{
+				// @ts-ignore
+				type: "error"
+			},
+			{
+				// @ts-ignore
+				type: "debug"
+			},
+			{
+				// @ts-ignore
+				type: "info"
+			},
+			{
+				// @ts-ignore
+				type: "success"
+			}
+		]);
+	});