diff --git a/package.json b/package.json index 37b5a89..6b5d140 100644 --- a/package.json +++ b/package.json @@ -68,7 +68,6 @@ "@graphql-codegen/cli": "^7.0.0", "@tsconfig/node22": "^22.0.5", "@types/node": "^20.11.24", - "dotenv": "^16.4.5", "oxfmt": "^0.51.0", "oxlint": "^1.63.0", "oxlint-tsgolint": "^0.22.1", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index fa2674b..2ed847a 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -31,9 +31,6 @@ importers: '@types/node': specifier: ^20.11.24 version: 20.14.10 - dotenv: - specifier: ^16.4.5 - version: 16.4.5 oxfmt: specifier: ^0.51.0 version: 0.51.0 @@ -1525,10 +1522,6 @@ packages: resolution: {integrity: sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA==} engines: {node: '>=8'} - dotenv@16.4.5: - resolution: {integrity: sha512-ZmdL2rui+eB2YwhsWzjInR8LldtZHGDoQ1ugH85ppHKwpUHL7j7rN0Ti9NCnGiQbhaZ11FpR+7ao1dNsmduNUg==} - engines: {node: '>=12'} - dotenv@8.6.0: resolution: {integrity: sha512-IrPdXQsk2BbzvCBGBOTmmSH5SodmqZNt4ERAZDmW4CT+tL8VtvinqywuANaFu4bOMWki16nqf0e4oC0QIaDr/g==} engines: {node: '>=10'} @@ -4473,8 +4466,6 @@ snapshots: dependencies: path-type: 4.0.0 - dotenv@16.4.5: {} - dotenv@8.6.0: {} dset@3.1.4: {} diff --git a/tests/integration/env.ts b/tests/integration/env.ts index ce6a851..24c25c7 100644 --- a/tests/integration/env.ts +++ b/tests/integration/env.ts @@ -1,11 +1,8 @@ -import { configDotenv } from "dotenv"; import { pino } from "pino"; export const ROOT_TEST_BRANCH_PREFIX = process.env.ROOT_TEST_BRANCH_PREFIX!; export const ROOT_TEMP_DIRECTORY = process.env.ROOT_TEMP_DIRECTORY!; -configDotenv(); - const GITHUB_TOKEN = process.env.GITHUB_TOKEN; if (!GITHUB_TOKEN) { throw new Error("GITHUB_TOKEN must be set"); diff --git a/vitest.integration.config.ts b/vitest.integration.config.ts index aac645d..22dd3d3 100644 --- a/vitest.integration.config.ts +++ b/vitest.integration.config.ts @@ -1,18 +1,18 @@ import { randomBytes } from "node:crypto"; import os from "node:os"; import path from "node:path"; +import { loadEnvFile } from "node:process"; import { defineConfig } from "vitest/config"; -const ROOT_TEST_BRANCH_PREFIX = - process.env.ROOT_TEST_BRANCH_PREFIX ?? - `test-${randomBytes(4).toString("hex")}`; +try { + loadEnvFile(); +} catch {} -const ROOT_TEMP_DIRECTORY = - process.env.ROOT_TEMP_DIRECTORY ?? - path.join(os.tmpdir(), ROOT_TEST_BRANCH_PREFIX); - -process.env.ROOT_TEST_BRANCH_PREFIX = ROOT_TEST_BRANCH_PREFIX; -process.env.ROOT_TEMP_DIRECTORY = ROOT_TEMP_DIRECTORY; +process.env.ROOT_TEST_BRANCH_PREFIX ??= `test-${randomBytes(4).toString("hex")}`; +process.env.ROOT_TEMP_DIRECTORY ??= path.join( + os.tmpdir(), + process.env.ROOT_TEST_BRANCH_PREFIX, +); export default defineConfig({ test: {