diff options
| author | Kevin J Hoerr <kjhoerr@protonmail.com> | 2021-09-25 17:11:29 +0000 |
|---|---|---|
| committer | Kevin J Hoerr <kjhoerr@protonmail.com> | 2021-09-25 17:11:29 +0000 |
| commit | dd829249122948fd66dd885dbd39a0cd9167118d (patch) | |
| tree | 241a3b5aae5c01cc888498a1ccf2a3a30b21bbcc | |
| parent | b3d3f8d8684c98383e304fa2cbdcdda774a5d637 (diff) | |
| download | ao-coverage-dd829249122948fd66dd885dbd39a0cd9167118d.tar.gz ao-coverage-dd829249122948fd66dd885dbd39a0cd9167118d.tar.bz2 ao-coverage-dd829249122948fd66dd885dbd39a0cd9167118d.zip | |
Tweak jest configuration
| -rw-r--r-- | .eslintrc.json | 3 | ||||
| -rw-r--r-- | package.json | 8 | ||||
| -rw-r--r-- | src/routes.test.ts | 22 |
3 files changed, 29 insertions, 4 deletions
diff --git a/.eslintrc.json b/.eslintrc.json index 5eff963..26cbded 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -8,8 +8,7 @@ "eslint:recommended", "plugin:@typescript-eslint/eslint-recommended", "plugin:@typescript-eslint/recommended", - "plugin:prettier/recommended", - "prettier/@typescript-eslint" + "plugin:prettier/recommended" ], "rules": { "no-var": "error", diff --git a/package.json b/package.json index 271dd1a..deda25d 100644 --- a/package.json +++ b/package.json @@ -15,7 +15,7 @@ "lint": "eslint 'src/**/*.ts'", "lint:fix": "eslint --fix 'src/**/*.ts'", "test": "jest", - "test:coverage": "jest --coverage --coverageReporters cobertura", + "test:coverage": "jest --coverage", "tsc": "tsc", "doc": "typedoc src" }, @@ -80,6 +80,10 @@ "lines": 85, "statements": 85 } - } + }, + "coverageReporters": [ + "cobertura", + "text" + ] } } 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"; |
