From ae1ef7a62691ef6685a2bbf7d51606d4ad87b108 Mon Sep 17 00:00:00 2001 From: BART! Date: Tue, 20 Aug 2024 22:51:28 +0200 Subject: [PATCH] test(outdir): test outdir with .env --- package.json | 4 ++-- tests/utils-test.ts | 7 +++---- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index 6a94567..82e75b8 100644 --- a/package.json +++ b/package.json @@ -16,7 +16,7 @@ "demo": "ts-node demo", "lint": "eslint ./src/**/**/* --fix", "test": "jest", - "test:outdir": "yarn outdir:prepare && yarn test --outDir='public' && yarn outdir:revert", + "test:outdir": "yarn outdir:prepare && OUT_DIR='public' yarn test && yarn outdir:revert", "outdir:prepare": "mv build public", "outdir:revert": "mv public build", "test:coverage": "jest --collect-coverage", @@ -81,4 +81,4 @@ "node": ">= 14.17.0" }, "license": "MIT" -} +} \ No newline at end of file diff --git a/tests/utils-test.ts b/tests/utils-test.ts index 2036ce9..11dbbe5 100644 --- a/tests/utils-test.ts +++ b/tests/utils-test.ts @@ -3,10 +3,9 @@ import { PagesJson } from '../src/interfaces/global.interface'; const options: { outDir?: string } = {}; -export const cliArgs = process.argv.filter((x) => x.startsWith('--outDir='))[0]; -if (cliArgs?.split('=')[1]) { - options.outDir = cliArgs?.split('=')[1]; -} +export const processEnv = process.env; + +if (process.env.OUT_DIR) options.outDir = process.env.OUT_DIR; export const optionsTest = options;