From 80c1fc940755e01c01afc55e039c7c3544dfe4ea Mon Sep 17 00:00:00 2001 From: jlenon7 Date: Sat, 27 Apr 2024 13:11:00 +0100 Subject: [PATCH] refactor(test): dont change environment after running --- package-lock.json | 4 ++-- package.json | 2 +- src/testing/BaseConsoleTest.ts | 21 ++------------------- src/testing/BaseHttpTest.ts | 9 +-------- 4 files changed, 6 insertions(+), 30 deletions(-) diff --git a/package-lock.json b/package-lock.json index f084709..179a214 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@athenna/core", - "version": "4.36.0", + "version": "4.37.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@athenna/core", - "version": "4.36.0", + "version": "4.37.0", "license": "MIT", "dependencies": { "pretty-repl": "^3.1.2", diff --git a/package.json b/package.json index 1cb1226..4342a99 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@athenna/core", - "version": "4.36.0", + "version": "4.37.0", "description": "One foundation for multiple applications.", "license": "MIT", "author": "João Lenon ", diff --git a/src/testing/BaseConsoleTest.ts b/src/testing/BaseConsoleTest.ts index 2e9fa97..913012b 100644 --- a/src/testing/BaseConsoleTest.ts +++ b/src/testing/BaseConsoleTest.ts @@ -7,14 +7,12 @@ * file that was distributed with this source code. */ -import { AfterAll, BeforeAll } from '@athenna/test' -import { Path, Json, Options } from '@athenna/common' +import { BeforeAll } from '@athenna/test' +import { Path, Options } from '@athenna/common' import { Ignite, type IgniteOptions } from '@athenna/core' import { TestCommand } from '@athenna/artisan/testing/plugins' export class BaseConsoleTest { - private env = Json.copy(process.env) - private config = Json.copy(Config.get()) public ignite: Ignite public igniteOptions: IgniteOptions = {} public artisanPath: string = Path.bootstrap(`artisan.${Path.ext()}`) @@ -27,21 +25,6 @@ export class BaseConsoleTest { Path.toHref(Path.bootstrap(`test.${Path.ext()}`)), this.getIgniteOptions() ) - - const { ViewProvider } = await import('@athenna/view') - const { ArtisanProvider } = await import('@athenna/artisan') - - new ViewProvider().register() - new ArtisanProvider().register() - } - - @AfterAll() - public async baseAfterAll() { - ioc.reconstruct() - process.env = Json.copy(this.env) - Object.keys(this.config).forEach(key => - Config.set(key, Json.copy(this.config[key])) - ) } private getIgniteOptions() { diff --git a/src/testing/BaseHttpTest.ts b/src/testing/BaseHttpTest.ts index 0ce3b49..468df5f 100644 --- a/src/testing/BaseHttpTest.ts +++ b/src/testing/BaseHttpTest.ts @@ -8,13 +8,11 @@ */ import { ServerImpl } from '@athenna/http' +import { Path, Options } from '@athenna/common' import { AfterAll, BeforeAll } from '@athenna/test' -import { Path, Json, Options } from '@athenna/common' import { Ignite, type HttpOptions, type IgniteOptions } from '@athenna/core' export class BaseHttpTest { - private env = Json.copy(process.env) - private config = Json.copy(Config.get()) public ignite: Ignite public httpServer: ServerImpl public httpOptions: HttpOptions = {} @@ -33,11 +31,6 @@ export class BaseHttpTest { @AfterAll() public async baseAfterAll() { await this.httpServer.close() - ioc.reconstruct() - process.env = Json.copy(this.env) - Object.keys(this.config).forEach(key => - Config.set(key, Json.copy(this.config[key])) - ) } private getHttpOptions() {