From a3158ec78df5cd09be5ba0c334a880e204766243 Mon Sep 17 00:00:00 2001 From: Mattias Olla Date: Tue, 3 Dec 2024 12:29:31 +0100 Subject: [PATCH 1/2] Relax test coverace requirements to 90% --- .c8rc | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.c8rc b/.c8rc index 1eadf40..dc2ebfb 100644 --- a/.c8rc +++ b/.c8rc @@ -1,9 +1,9 @@ { "reporter": ["text", "html"], "all": true, - "statements": "100", - "branches": "100", - "functions": "100", - "lines": "100", - "exclude": ["coverage", "dist", "test", "index.ts", "eslint.config.js", "tsup.config.ts"] + "statements": "90", + "branches": "90", + "functions": "90", + "lines": "90", + "exclude": ["coverage", "dist", "test", "index.ts", "tsup.config.ts"] } From 2a2c84f4a34607afc66c1382e2498a8ddd3fccdc Mon Sep 17 00:00:00 2001 From: Mattias Olla Date: Tue, 3 Dec 2024 12:29:53 +0100 Subject: [PATCH 2/2] Remove now redundant c8 ignore comments --- lib/logging.ts | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/lib/logging.ts b/lib/logging.ts index 54171dc..1a428f4 100644 --- a/lib/logging.ts +++ b/lib/logging.ts @@ -1,8 +1,8 @@ import pino, { + Level, DestinationStream as PinoDestinationStream, Logger as PinoLogger, LoggerOptions as PinoOptions, - Level, } from "pino"; import { getStore } from "./middleware"; @@ -43,7 +43,7 @@ export type DestinationStream = PinoDestinationStream; * Creates a pino logger that is pre-configured and ready to be used with minimal setup. */ export function logger(options: LoggerOptions = {}, stream?: DestinationStream | undefined): Logger { - const env = process.env.NODE_ENV /* c8 ignore next */ || "development"; + const env = process.env.NODE_ENV || "development"; const shouldPrettyPrint = [ "development", "test", "dev" ].includes(env) && !stream; const logLocation = env === "test" && "./logs/test.log"; @@ -55,7 +55,6 @@ export function logger(options: LoggerOptions = {}, stream?: DestinationStream | messageKey = "message", timestamp = () => `,"time": "${new Date().toISOString()}"`, formatLog, - /* c8 ignore start */ transport = shouldPrettyPrint ? { target: "pino-pretty", @@ -66,7 +65,6 @@ export function logger(options: LoggerOptions = {}, stream?: DestinationStream | }, } : undefined, - /* c8 ignore stop */ mixin, ...rest } = options; @@ -78,8 +76,7 @@ export function logger(options: LoggerOptions = {}, stream?: DestinationStream | messageKey, timestamp, formatters: { - level: (label) => - shouldPrettyPrint ? /* c8 ignore next */ { level: label } : { severity: gcpSeverity(label) }, + level: (label) => (shouldPrettyPrint ? { level: label } : { severity: gcpSeverity(label) }), ...(formatLog && { log: formatLog }), }, transport, @@ -104,7 +101,6 @@ function gcpSeverity(label: string) { return "ERROR"; case "fatal": return "CRITICAL"; - /* c8 ignore next 2 */ default: return "DEFAULT"; }