diff options
| author | Kevin J Hoerr <kjhoerr@protonmail.com> | 2019-12-12 15:39:06 -0500 |
|---|---|---|
| committer | Kevin J Hoerr <kjhoerr@protonmail.com> | 2019-12-12 15:39:06 -0500 |
| commit | 15930182a7ca048a2472e0120650646542b31614 (patch) | |
| tree | a7450b94fb899fde5b0eaaa4cdc7a395a03493ad | |
| parent | bc549648b38698b7bd3cb71ab7e71bb17a3a68a1 (diff) | |
| download | ao-coverage-15930182a7ca048a2472e0120650646542b31614.tar.gz ao-coverage-15930182a7ca048a2472e0120650646542b31614.tar.bz2 ao-coverage-15930182a7ca048a2472e0120650646542b31614.zip | |
Use nullish-coalescing op for env var assignments
| -rw-r--r-- | CHANGELOG.md | 2 | ||||
| -rw-r--r-- | package.json | 3 | ||||
| -rw-r--r-- | src/formats.ts | 2 | ||||
| -rw-r--r-- | src/index.ts | 8 | ||||
| -rw-r--r-- | src/routes.ts | 4 | ||||
| -rw-r--r-- | src/util/logger.ts | 2 |
6 files changed, 12 insertions, 9 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index a4cc454..ab5e446 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Exit application if bash template could not be created, and does not already exist - Generalize template processing, for unit tests and for future flexibility +- Fixed rounding for default color matcher when inbetween step values +- Use new nullish coalescing operator for environment variable assignments ## [0.3.1] diff --git a/package.json b/package.json index 2548e55..4f9424e 100644 --- a/package.json +++ b/package.json @@ -53,7 +53,8 @@ "testEnvironment": "node", "collectCoverageFrom": [ "src/**/*.ts", - "!src/**/*.test.ts" + "!src/**/*.test.ts", + "!src/index.ts" ], "roots": [ "src/" diff --git a/src/formats.ts b/src/formats.ts index b64c418..8de55b1 100644 --- a/src/formats.ts +++ b/src/formats.ts @@ -47,7 +47,7 @@ const FormatsObj: FormatObj = { tarpaulin: { parseCoverage: (file: Document): CoverageResult => { const scripts = file.getElementsByTagName("script"); - if (scripts.length == 0) { + if (scripts.length === 0) { return new InvalidReportDocumentError(); } const data = scripts[0].text; diff --git a/src/index.ts b/src/index.ts index 12bbd76..27f4572 100644 --- a/src/index.ts +++ b/src/index.ts @@ -16,14 +16,14 @@ import loggerConfig from "./util/logger"; import { configOrError, handleShutdown } from "./util/config"; // Start-up configuration -const BIND_ADDRESS = process.env.BIND_ADDRESS || "localhost"; -const PORT = Number(process.env.PORT || 3000); -const TARGET_URL = process.env.TARGET_URL || "http://localhost:3000"; +const BIND_ADDRESS = process.env.BIND_ADDRESS ?? "localhost"; +const PORT = Number(process.env.PORT ?? 3000); +const TARGET_URL = process.env.TARGET_URL ?? "http://localhost:3000"; const logger = winston.createLogger(loggerConfig("ROOT")); const MONGO_URI = configOrError("MONGO_URI"); -const MONGO_DB = process.env.MONGO_DB || "ao-coverage"; +const MONGO_DB = process.env.MONGO_DB ?? "ao-coverage"; const HOST_DIR = configOrError("HOST_DIR"); fs.accessSync(HOST_DIR, fs.constants.R_OK | fs.constants.W_OK); diff --git a/src/routes.ts b/src/routes.ts index d429659..79b6fea 100644 --- a/src/routes.ts +++ b/src/routes.ts @@ -11,8 +11,8 @@ import { configOrError } from "./util/config"; import loggerConfig from "./util/logger"; import { Messages } from "./errors"; -const TOKEN = process.env.TOKEN || ""; -const UPLOAD_LIMIT = Number(process.env.UPLOAD_LIMIT || 4194304); +const TOKEN = process.env.TOKEN ?? ""; +const UPLOAD_LIMIT = Number(process.env.UPLOAD_LIMIT ?? 4194304); const HOST_DIR = configOrError("HOST_DIR"); const logger = winston.createLogger(loggerConfig("HTTP")); diff --git a/src/util/logger.ts b/src/util/logger.ts index 27eeefe..2fc0749 100644 --- a/src/util/logger.ts +++ b/src/util/logger.ts @@ -4,7 +4,7 @@ import * as Transport from "winston-transport"; const { combine, splat, timestamp, label, colorize, printf } = winston.format; const { Console } = winston.transports; -const LOG_LEVEL = process.env.LOG_LEVEL || "info"; +const LOG_LEVEL = process.env.LOG_LEVEL ?? "info"; const consoleFormat = combine( colorize(), |
