Skip to content

Commit 27d99e8

Browse files
authored
all[minor]: Add ability to disable console logs in tests (#6009)
1 parent 9acba0a commit 27d99e8

File tree

22 files changed

+132
-0
lines changed

22 files changed

+132
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
11
import { awaitAllCallbacks } from "@langchain/core/callbacks/promises";
2+
import { afterAll, jest } from "@jest/globals";
23

34
afterAll(awaitAllCallbacks);
5+
6+
// Allow console.log to be disabled in tests
7+
if (process.env.DISABLE_CONSOLE_LOGS === "true") {
8+
console.log = jest.fn();
9+
}
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
11
import { awaitAllCallbacks } from "@langchain/core/callbacks/promises";
2+
import { afterAll, jest } from "@jest/globals";
23

34
afterAll(awaitAllCallbacks);
5+
6+
// Allow console.log to be disabled in tests
7+
if (process.env.DISABLE_CONSOLE_LOGS === "true") {
8+
console.log = jest.fn();
9+
}
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
11
import { awaitAllCallbacks } from "@langchain/core/callbacks/promises";
2+
import { afterAll, jest } from "@jest/globals";
23

34
afterAll(awaitAllCallbacks);
5+
6+
// Allow console.log to be disabled in tests
7+
if (process.env.DISABLE_CONSOLE_LOGS === "true") {
8+
console.log = jest.fn();
9+
}
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
11
import { awaitAllCallbacks } from "@langchain/core/callbacks/promises";
2+
import { afterAll, jest } from "@jest/globals";
23

34
afterAll(awaitAllCallbacks);
5+
6+
// Allow console.log to be disabled in tests
7+
if (process.env.DISABLE_CONSOLE_LOGS === "true") {
8+
console.log = jest.fn();
9+
}
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
11
import { awaitAllCallbacks } from "@langchain/core/callbacks/promises";
2+
import { afterAll, jest } from "@jest/globals";
23

34
afterAll(awaitAllCallbacks);
5+
6+
// Allow console.log to be disabled in tests
7+
if (process.env.DISABLE_CONSOLE_LOGS === "true") {
8+
console.log = jest.fn();
9+
}
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
11
import { awaitAllCallbacks } from "@langchain/core/callbacks/promises";
2+
import { afterAll, jest } from "@jest/globals";
23

34
afterAll(awaitAllCallbacks);
5+
6+
// Allow console.log to be disabled in tests
7+
if (process.env.DISABLE_CONSOLE_LOGS === "true") {
8+
console.log = jest.fn();
9+
}
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
11
import { awaitAllCallbacks } from "@langchain/core/callbacks/promises";
2+
import { afterAll, jest } from "@jest/globals";
23

34
afterAll(awaitAllCallbacks);
5+
6+
// Allow console.log to be disabled in tests
7+
if (process.env.DISABLE_CONSOLE_LOGS === "true") {
8+
console.log = jest.fn();
9+
}
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
11
import { awaitAllCallbacks } from "@langchain/core/callbacks/promises";
2+
import { afterAll, jest } from "@jest/globals";
23

34
afterAll(awaitAllCallbacks);
5+
6+
// Allow console.log to be disabled in tests
7+
if (process.env.DISABLE_CONSOLE_LOGS === "true") {
8+
console.log = jest.fn();
9+
}
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
11
import { awaitAllCallbacks } from "@langchain/core/callbacks/promises";
2+
import { afterAll, jest } from "@jest/globals";
23

34
afterAll(awaitAllCallbacks);
5+
6+
// Allow console.log to be disabled in tests
7+
if (process.env.DISABLE_CONSOLE_LOGS === "true") {
8+
console.log = jest.fn();
9+
}
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
11
import { awaitAllCallbacks } from "@langchain/core/callbacks/promises";
2+
import { afterAll, jest } from "@jest/globals";
23

34
afterAll(awaitAllCallbacks);
5+
6+
// Allow console.log to be disabled in tests
7+
if (process.env.DISABLE_CONSOLE_LOGS === "true") {
8+
console.log = jest.fn();
9+
}
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
11
import { awaitAllCallbacks } from "@langchain/core/callbacks/promises";
2+
import { afterAll, jest } from "@jest/globals";
23

34
afterAll(awaitAllCallbacks);
5+
6+
// Allow console.log to be disabled in tests
7+
if (process.env.DISABLE_CONSOLE_LOGS === "true") {
8+
console.log = jest.fn();
9+
}
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
11
import { awaitAllCallbacks } from "@langchain/core/callbacks/promises";
2+
import { afterAll, jest } from "@jest/globals";
23

34
afterAll(awaitAllCallbacks);
5+
6+
// Allow console.log to be disabled in tests
7+
if (process.env.DISABLE_CONSOLE_LOGS === "true") {
8+
console.log = jest.fn();
9+
}
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
11
import { awaitAllCallbacks } from "@langchain/core/callbacks/promises";
2+
import { afterAll, jest } from "@jest/globals";
23

34
afterAll(awaitAllCallbacks);
5+
6+
// Allow console.log to be disabled in tests
7+
if (process.env.DISABLE_CONSOLE_LOGS === "true") {
8+
console.log = jest.fn();
9+
}
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
11
import { awaitAllCallbacks } from "@langchain/core/callbacks/promises";
2+
import { afterAll, jest } from "@jest/globals";
23

34
afterAll(awaitAllCallbacks);
5+
6+
// Allow console.log to be disabled in tests
7+
if (process.env.DISABLE_CONSOLE_LOGS === "true") {
8+
console.log = jest.fn();
9+
}
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
11
import { awaitAllCallbacks } from "@langchain/core/callbacks/promises";
2+
import { afterAll, jest } from "@jest/globals";
23

34
afterAll(awaitAllCallbacks);
5+
6+
// Allow console.log to be disabled in tests
7+
if (process.env.DISABLE_CONSOLE_LOGS === "true") {
8+
console.log = jest.fn();
9+
}
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
11
import { awaitAllCallbacks } from "@langchain/core/callbacks/promises";
2+
import { afterAll, jest } from "@jest/globals";
23

34
afterAll(awaitAllCallbacks);
5+
6+
// Allow console.log to be disabled in tests
7+
if (process.env.DISABLE_CONSOLE_LOGS === "true") {
8+
console.log = jest.fn();
9+
}
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
11
import { awaitAllCallbacks } from "@langchain/core/callbacks/promises";
2+
import { afterAll, jest } from "@jest/globals";
23

34
afterAll(awaitAllCallbacks);
5+
6+
// Allow console.log to be disabled in tests
7+
if (process.env.DISABLE_CONSOLE_LOGS === "true") {
8+
console.log = jest.fn();
9+
}
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
11
import { awaitAllCallbacks } from "@langchain/core/callbacks/promises";
2+
import { afterAll, jest } from "@jest/globals";
23

34
afterAll(awaitAllCallbacks);
5+
6+
// Allow console.log to be disabled in tests
7+
if (process.env.DISABLE_CONSOLE_LOGS === "true") {
8+
console.log = jest.fn();
9+
}
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
11
import { awaitAllCallbacks } from "@langchain/core/callbacks/promises";
2+
import { afterAll, jest } from "@jest/globals";
23

34
afterAll(awaitAllCallbacks);
5+
6+
// Allow console.log to be disabled in tests
7+
if (process.env.DISABLE_CONSOLE_LOGS === "true") {
8+
console.log = jest.fn();
9+
}
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
11
import { awaitAllCallbacks } from "@langchain/core/callbacks/promises";
2+
import { afterAll, jest } from "@jest/globals";
23

34
afterAll(awaitAllCallbacks);
5+
6+
// Allow console.log to be disabled in tests
7+
if (process.env.DISABLE_CONSOLE_LOGS === "true") {
8+
console.log = jest.fn();
9+
}
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
11
import { awaitAllCallbacks } from "@langchain/core/callbacks/promises";
2+
import { afterAll, jest } from "@jest/globals";
23

34
afterAll(awaitAllCallbacks);
5+
6+
// Allow console.log to be disabled in tests
7+
if (process.env.DISABLE_CONSOLE_LOGS === "true") {
8+
console.log = jest.fn();
9+
}
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
11
import { awaitAllCallbacks } from "@langchain/core/callbacks/promises";
2+
import { afterAll, jest } from "@jest/globals";
23

34
afterAll(awaitAllCallbacks);
5+
6+
// Allow console.log to be disabled in tests
7+
if (process.env.DISABLE_CONSOLE_LOGS === "true") {
8+
console.log = jest.fn();
9+
}

0 commit comments

Comments
 (0)