Skip to content

Commit

Permalink
Remove process.env on codepath
Browse files Browse the repository at this point in the history
  • Loading branch information
eddie-atkinson committed Aug 17, 2024
1 parent 03803e4 commit dc442cb
Show file tree
Hide file tree
Showing 5 changed files with 1,096 additions and 1,016 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@
"@tsconfig/node12": "12.1.3",
"@types/har-format": "^1.2.15",
"@types/jest": "29.5.12",
"@types/node": "^22.4.0",
"@types/tough-cookie": "^4.0.2",
"@typescript-eslint/eslint-plugin": "5.62.0",
"@typescript-eslint/parser": "5.62.0",
Expand Down
6 changes: 3 additions & 3 deletions src/lib/fetchDevel.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class FakeResponse {
Object.keys(props).forEach((key) => (this[key] = props[key]));
const rawHeaders = this.headers;
this.headers = new Headers(rawHeaders);
this.headers.getSetCookie = () => rawHeaders['set-cookie'];
this.headers.getSetCookie = () => rawHeaders["set-cookie"];
}

async json() {
Expand Down Expand Up @@ -69,8 +69,8 @@ async function fetchDevel(url, fetchOptions) {
} catch (error) {
if (error.code === "ENOENT") {
const res = await fetch(origUrl, fetchOptions);
const {ok, status, statusText, headers} = res
const { ok, status, statusText, headers } = res;

contentObj = {
request: {
url: url,
Expand Down
1 change: 0 additions & 1 deletion src/lib/options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ const ValidationOptionsSchema = Type.Object({
logOptionsErrors: Type.Optional(Type.Boolean()),
_internalThrowOnAdditionalProperties: Type.Optional(
Type.Boolean({
default: process.env.NODE_ENV === "test",
description:
"Use this property to throw when properties beyond what is explicitly specified in the schema are provided. It is an internal option and subject to change, use at your own risk",
}),
Expand Down
8 changes: 7 additions & 1 deletion tests/testYf.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,13 @@ import _moduleExec from "../src/lib/moduleExec";
export default function genYf(extend: object): any {
return {
_env,
_opts,
_opts: {
..._opts,
validation: {
...(_opts?.validation ?? {}),
_internalThrowOnAdditionalProperties: true,
},
},
_fetch,
_moduleExec,
...extend,
Expand Down
Loading

0 comments on commit dc442cb

Please sign in to comment.