From a468df8fe6d48173e2f79e82e3579b845523a407 Mon Sep 17 00:00:00 2001 From: Ardalan Amini Date: Sat, 29 Oct 2022 22:38:45 +0330 Subject: [PATCH] feat: Allow ability to modify the config in `test` environment --- src/index.ts | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/src/index.ts b/src/index.ts index abf48cd..4a1f134 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,16 +1,16 @@ +import content from "#src/config"; import { + ConfigI, DEFAULT, ENV, - SERVER_PROTOCOL, - ConfigI, - ServerConfigI, - SubdomainConfigI, JsonConfigI, JsonpConfigI, - QueryConfigI, ProxyConfigI, + QueryConfigI, + SERVER_PROTOCOL, + ServerConfigI, + SubdomainConfigI, } from "#src/constants"; -import content from "#src/config"; import Joi from "joi"; import os from "os"; @@ -84,8 +84,7 @@ function freeze>(obj: T): T { return Object.freeze(obj); } -// eslint-disable-next-line @typescript-eslint/no-non-null-assertion -const CONFIG = freeze(config!); +const CONFIG: ConfigI = config?.env === ENV.TEST ? config : freeze(config); /* ------------------------- Exports ------------------------- */