aboutsummaryrefslogtreecommitdiff
path: root/src/routes.test.ts
diff options
context:
space:
mode:
authorKevin J Hoerr <kjhoerr@protonmail.com>2021-09-25 17:11:29 +0000
committerKevin J Hoerr <kjhoerr@protonmail.com>2021-09-25 17:11:29 +0000
commitdd829249122948fd66dd885dbd39a0cd9167118d (patch)
tree241a3b5aae5c01cc888498a1ccf2a3a30b21bbcc /src/routes.test.ts
parentb3d3f8d8684c98383e304fa2cbdcdda774a5d637 (diff)
downloadao-coverage-dd829249122948fd66dd885dbd39a0cd9167118d.tar.gz
ao-coverage-dd829249122948fd66dd885dbd39a0cd9167118d.tar.bz2
ao-coverage-dd829249122948fd66dd885dbd39a0cd9167118d.zip
Tweak jest configuration
Diffstat (limited to 'src/routes.test.ts')
-rw-r--r--src/routes.test.ts22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/routes.test.ts b/src/routes.test.ts
index 7f275b9..dc2b6a6 100644
--- a/src/routes.test.ts
+++ b/src/routes.test.ts
@@ -23,6 +23,28 @@ test("HOST_DIR must be readable and writable", () => {
).not.toThrowError();
});
+import { Writable } from "stream";
+import winston from "winston";
+
+let output = "";
+
+jest.mock("./util/logger", () => {
+ const stream = new Writable();
+ stream._write = (chunk, _encoding, next) => {
+ output = output += chunk.toString();
+ next();
+ };
+ const streamTransport = new winston.transports.Stream({ stream });
+
+ return {
+ __esModule: true,
+ default: () => ({
+ format: winston.format.combine(winston.format.splat(), winston.format.simple()),
+ transports: [streamTransport]
+ })
+ }
+});
+
import { configOrError, persistTemplate } from "./util/config";
import routes from "./routes";
import Metadata, { EnvConfig } from "./metadata";