Skip to content

Commit

Permalink
test(outdir): test outdir with .env
Browse files Browse the repository at this point in the history
  • Loading branch information
bartholomej committed Aug 20, 2024
1 parent 5442d3a commit ae1ef7a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -81,4 +81,4 @@
"node": ">= 14.17.0"
},
"license": "MIT"
}
}
7 changes: 3 additions & 4 deletions tests/utils-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

0 comments on commit ae1ef7a

Please sign in to comment.