Skip to content

Commit

Permalink
Don't log warnings in test
Browse files Browse the repository at this point in the history
  • Loading branch information
benjie committed Feb 22, 2024
1 parent fe7613a commit 4d9f83d
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions grafast/grafast/src/dev.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,12 @@ const graphileEnv =
typeof process !== "undefined" ? process.env.GRAPHILE_ENV : undefined;
const nodeEnv =
typeof process !== "undefined" ? process.env.NODE_ENV : undefined;
const mode = graphileEnv !== undefined ? graphileEnv : nodeEnv;
/**
* @internal
*/
export const isDev =
graphileEnv !== undefined
? graphileEnv === "development" || graphileEnv === "test"
: nodeEnv === "development" || nodeEnv === "test";
export const isDev = mode === "development" || mode === "test";
export const isTest = mode === "test";
export function noop(): void {}

if (
Expand All @@ -22,7 +21,7 @@ if (
console.warn(
`The GRAPHILE_ENV environmental variable is not set; Grafast will run in production mode. In your development environments, it's recommended that you set \`GRAPHILE_ENV=development\` to opt in to additional checks that will provide guidance and help you to catch issues in your code earlier, and other changes such as formatting to improve your development experience.`,
);
} else if (isDev) {
} else if (isDev && !isTest) {
console.warn(
`Grafast is running in development mode due to \`${
graphileEnv !== undefined
Expand Down

0 comments on commit 4d9f83d

Please sign in to comment.