From 093788431de3cd97c62818fa39b61e1fe46362a6 Mon Sep 17 00:00:00 2001 From: timbrinded <79199034+timbrinded@users.noreply.github.com> Date: Thu, 16 Nov 2023 21:43:48 +0000 Subject: [PATCH] undid config globalSetup --- packages/cli/src/cmds/runTests.ts | 13 ------------- packages/cli/src/internal/vitestSetup.ts | 6 ------ packages/cli/src/lib/configReader.ts | 8 -------- packages/cli/src/lib/globalContextEffect.ts | 3 +++ 4 files changed, 3 insertions(+), 27 deletions(-) delete mode 100644 packages/cli/src/internal/vitestSetup.ts diff --git a/packages/cli/src/cmds/runTests.ts b/packages/cli/src/cmds/runTests.ts index 539b8b57..6013614d 100644 --- a/packages/cli/src/cmds/runTests.ts +++ b/packages/cli/src/cmds/runTests.ts @@ -18,18 +18,6 @@ import { runNetworkOnly as legacyRunNetworkOnly, contextCreator, } from "../lib/globalContext"; -import { fileURLToPath } from "url"; - -let __dirname; - -if (typeof import.meta.url !== "undefined") { - // ESM environment - __dirname = path.dirname(fileURLToPath(import.meta.url)); -} else { - // CJS environment - // eslint-disable-next-line no-self-assign - __dirname = __dirname; -} export const testEffect = (envName: string, additionalArgs?: object) => { return Effect.gen(function* (_) { @@ -166,7 +154,6 @@ export const executeTestEffect = (env: Environment, additionalArgs?: object) => const baseOptions = { watch: false, globals: true, - setupFiles: [path.join(__dirname, "internal/vitestSetup.js")], reporters: env.reporters ? env.reporters : ["default"], outputFile: env.reportFile, testTimeout: env.timeout || globalConfig.defaultTestTimeout, diff --git a/packages/cli/src/internal/vitestSetup.ts b/packages/cli/src/internal/vitestSetup.ts deleted file mode 100644 index b5ad3b60..00000000 --- a/packages/cli/src/internal/vitestSetup.ts +++ /dev/null @@ -1,6 +0,0 @@ -import { importJsonConfig } from "../lib/configReader"; -import { beforeAll } from "vitest"; - -beforeAll(() => { - globalThis.config = importJsonConfig(); -}); diff --git a/packages/cli/src/lib/configReader.ts b/packages/cli/src/lib/configReader.ts index 9368dc92..dc03f40f 100644 --- a/packages/cli/src/lib/configReader.ts +++ b/packages/cli/src/lib/configReader.ts @@ -69,10 +69,6 @@ export function isEthereumDevConfig(): boolean { } export function importJsonConfig(): MoonwallConfig { - if (globalThis.config) { - return replaceEnvVars(globalThis.config); - } - const configPath = process.env.MOON_CONFIG_PATH!; const filePath = path.isAbsolute(configPath) ? configPath : path.join(process.cwd(), configPath); @@ -87,10 +83,6 @@ export function importJsonConfig(): MoonwallConfig { } export async function importAsyncConfig() { - if (globalThis.config) { - return replaceEnvVars(globalThis.config); - } - const configPath = process.env.MOON_CONFIG_PATH!; const filePath = path.isAbsolute(configPath) ? configPath : path.join(process.cwd(), configPath); diff --git a/packages/cli/src/lib/globalContextEffect.ts b/packages/cli/src/lib/globalContextEffect.ts index 3d6a4d1c..8ccc69eb 100644 --- a/packages/cli/src/lib/globalContextEffect.ts +++ b/packages/cli/src/lib/globalContextEffect.ts @@ -505,6 +505,9 @@ export class MoonwallContext { export const createContextEffect = () => Effect.gen(function* (_) { + // console.log("globalThis.config", globalThis.config.length); + // console.dir(globalThis.config, { depth: 1 }) + const config = yield* _( Effect.tryPromise({ try: () => importAsyncConfig(),