Skip to content

Commit

Permalink
cr
Browse files Browse the repository at this point in the history
  • Loading branch information
bracesproul committed Jul 30, 2024
1 parent d35cdd7 commit a23bbc2
Show file tree
Hide file tree
Showing 34 changed files with 34 additions and 19 deletions.
1 change: 1 addition & 0 deletions langchain-core/src/caches/tests/in_memory_cache.test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { test, expect } from "@jest/globals";
import { MessageContentComplex } from "../../messages/base.js";
import { InMemoryCache } from "../base.js";

Expand Down
2 changes: 1 addition & 1 deletion langchain-core/src/callbacks/tests/manager.int.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* eslint-disable no-process-env */
import { test } from "@jest/globals";
import { test, expect } from "@jest/globals";

import { PromptTemplate } from "../../prompts/prompt.js";
import { FakeLLM } from "../../utils/testing/index.js";
Expand Down
1 change: 1 addition & 0 deletions langchain-core/src/callbacks/tests/run_collector.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { BaseLLM } from "../../language_models/llms.js";
import { StringOutputParser } from "../../output_parsers/string.js";
import type { LLMResult } from "../../outputs.js";
import { RunCollectorCallbackHandler } from "../../tracers/run_collector.js";
import { describe, it, expect } from "@jest/globals";

Check failure on line 12 in langchain-core/src/callbacks/tests/run_collector.test.ts

View workflow job for this annotation

GitHub Actions / Check linting

`@jest/globals` import should occur before import of `../../prompts/chat.js`

class FakeLLM extends BaseLLM {
nrMapCalls = 0;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* eslint-disable no-promise-executor-return */

import { test } from "@jest/globals";
import { test, expect } from "@jest/globals";
import { z } from "zod";
import { zodToJsonSchema } from "zod-to-json-schema";
import { FakeChatModel, FakeListChatModel } from "../../utils/testing/index.js";
Expand Down
2 changes: 1 addition & 1 deletion langchain-core/src/language_models/tests/llms.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* eslint-disable no-promise-executor-return */

import { test } from "@jest/globals";
import { test, expect } from "@jest/globals";
import { FakeLLM, FakeStreamingLLM } from "../../utils/testing/index.js";
import { HumanMessagePromptTemplate } from "../../prompts/chat.js";

Expand Down
2 changes: 1 addition & 1 deletion langchain-core/src/messages/tests/message_utils.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { it, expect } from "@jest/globals";
import { it, describe, test, expect } from "@jest/globals";
import {
filterMessages,
mergeMessageRuns,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { test } from "@jest/globals";
import { test, expect } from "@jest/globals";
import { z } from "zod";
import { JsonOutputKeyToolsParser } from "../json_output_tools_parsers.js";
import { AIMessage } from "../../../messages/index.js";
Expand Down
1 change: 1 addition & 0 deletions langchain-core/src/output_parsers/tests/json.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { RunnableSequence } from "../../runnables/base.js";
import { RunnablePassthrough } from "../../runnables/passthrough.js";
import { FakeStreamingLLM } from "../../utils/testing/index.js";
import { JsonOutputParser } from "../json.js";
import { test, expect } from "@jest/globals";

Check failure on line 6 in langchain-core/src/output_parsers/tests/json.test.ts

View workflow job for this annotation

GitHub Actions / Check linting

`@jest/globals` import should occur before import of `../../prompts/chat.js`

const STREAMED_TOKENS = `
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint-disable no-loop-func */
/* eslint-disable no-promise-executor-return */

import { test } from "@jest/globals";
import { test, expect } from "@jest/globals";
import { FakeStreamingLLM } from "../../utils/testing/index.js";
import { BytesOutputParser } from "../bytes.js";
import {
Expand Down
2 changes: 1 addition & 1 deletion langchain-core/src/output_parsers/tests/string.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { describe } from "@jest/globals";
import { describe, test, expect } from "@jest/globals";
import { StringOutputParser } from "../string.js";
import {
AIMessage,
Expand Down
1 change: 1 addition & 0 deletions langchain-core/src/output_parsers/tests/xml.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { FakeStreamingLLM } from "../../utils/testing/index.js";
import { XMLOutputParser } from "../xml.js";
import { test, expect } from "@jest/globals";

Check failure on line 3 in langchain-core/src/output_parsers/tests/xml.test.ts

View workflow job for this annotation

GitHub Actions / Check linting

`@jest/globals` import should occur before import of `../../utils/testing/index.js`

const XML_EXAMPLE = `<?xml version="1.0" encoding="UTF-8"?>
<userProfile>
Expand Down
2 changes: 1 addition & 1 deletion langchain-core/src/prompts/tests/few_shot.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { expect, test } from "@jest/globals";
import { expect, describe, test } from "@jest/globals";
import {
FewShotChatMessagePromptTemplate,
FewShotPromptTemplate,
Expand Down
1 change: 1 addition & 0 deletions langchain-core/src/prompts/tests/structured.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { RunnableConfig } from "../../runnables/config.js";
import { FakeListChatModel } from "../../utils/testing/index.js";
import { StructuredPrompt } from "../structured.js";
import { load } from "../../load/index.js";
import { test, expect } from "@jest/globals";

Check failure on line 14 in langchain-core/src/prompts/tests/structured.test.ts

View workflow job for this annotation

GitHub Actions / Check linting

`@jest/globals` import should occur before import of `../../language_models/base.js`

class FakeStructuredChatModel extends FakeListChatModel {
withStructuredOutput<
Expand Down
1 change: 1 addition & 0 deletions langchain-core/src/runnables/tests/runnable.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import { RunnableSequence, RunnableLambda } from "../base.js";
import { RouterRunnable } from "../router.js";
import { RunnableConfig } from "../config.js";
import { JsonOutputParser } from "../../output_parsers/json.js";
import { test, expect, describe } from "@jest/globals";

Check failure on line 31 in langchain-core/src/runnables/tests/runnable.test.ts

View workflow job for this annotation

GitHub Actions / Check linting

`@jest/globals` import should occur before import of `../../language_models/chat_models.js`

Check failure on line 31 in langchain-core/src/runnables/tests/runnable.test.ts

View workflow job for this annotation

GitHub Actions / Check linting

'/home/runner/work/langchainjs/langchainjs/node_modules/@jest/globals/build/index.js' imported multiple times

test("Test batch", async () => {
const llm = new FakeLLM({});
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* eslint-disable no-promise-executor-return */
/* eslint-disable @typescript-eslint/no-explicit-any */
import { test } from "@jest/globals";
import { test, expect } from "@jest/globals";
import { StringOutputParser } from "../../output_parsers/string.js";
import { FakeChatModel, FakeStreamingLLM } from "../../utils/testing/index.js";

Expand Down
2 changes: 1 addition & 1 deletion langchain-core/src/runnables/tests/runnable_branch.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint-disable no-promise-executor-return */
/* eslint-disable @typescript-eslint/no-explicit-any */

import { test } from "@jest/globals";
import { test, expect } from "@jest/globals";
import { RunnableBranch } from "../branch.js";
import { ChatPromptTemplate } from "../../prompts/chat.js";
import { FakeStreamingLLM } from "../../utils/testing/index.js";
Expand Down
1 change: 1 addition & 0 deletions langchain-core/src/runnables/tests/runnable_graph.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { StringOutputParser } from "../../output_parsers/string.js";
import { FakeLLM } from "../../utils/testing/index.js";
import { PromptTemplate } from "../../prompts/prompt.js";
import { CommaSeparatedListOutputParser } from "../../output_parsers/list.js";
import { test, expect } from "@jest/globals";

Check failure on line 7 in langchain-core/src/runnables/tests/runnable_graph.test.ts

View workflow job for this annotation

GitHub Actions / Check linting

`@jest/globals` import should occur before import of `../../output_parsers/string.js`

test("Test graph single runnable", async () => {
const jsonOutputParser = new StringOutputParser();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import {
} from "../../utils/testing/index.js";
import { ChatPromptTemplate, MessagesPlaceholder } from "../../prompts/chat.js";
import { StringOutputParser } from "../../output_parsers/string.js";
import { test, expect } from "@jest/globals";

Check failure on line 23 in langchain-core/src/runnables/tests/runnable_history.test.ts

View workflow job for this annotation

GitHub Actions / Check linting

`@jest/globals` import should occur before import of `../../messages/index.js`

// For `BaseChatMessageHistory`
async function getGetSessionHistory(): Promise<
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import { StringOutputParser } from "../../output_parsers/string.js";
import { PromptTemplate } from "../../prompts/prompt.js";
import { RunnableSequence } from "../base.js";
import { test, expect } from "@jest/globals";

Check failure on line 7 in langchain-core/src/runnables/tests/runnable_interface.test.ts

View workflow job for this annotation

GitHub Actions / Check linting

`@jest/globals` import should occur before import of `../../output_parsers/string.js`

type RunnableBatchOptionsV0 = {
maxConcurrency?: number;
Expand Down
1 change: 1 addition & 0 deletions langchain-core/src/runnables/tests/runnable_map.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import {
} from "../../utils/testing/index.js";
import { RunnableSequence, RunnableMap } from "../base.js";
import { RunnablePassthrough } from "../passthrough.js";
import { test, expect } from "@jest/globals";

test("Create a runnable sequence with a runnable map", async () => {
const promptTemplate = ChatPromptTemplate.fromMessages<{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { RunnablePassthrough } from "../passthrough.js";
import { JsonOutputParser } from "../../output_parsers/json.js";
import { RunnableSequence } from "../base.js";
import { RunnableConfig } from "../config.js";
import { test, expect } from "@jest/globals";

test("RunnablePassthrough can call .assign and pass prev result through", async () => {
const promptTemplate = PromptTemplate.fromTemplate("{input}");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { HumanMessage } from "../../messages/index.js";
import { applyPatch } from "../../utils/json_patch.js";
import { RemoteRunnable } from "../remote.js";
import { test, expect } from "@jest/globals";

test("invoke hosted langserve", async () => {
const remote = new RemoteRunnable({
Expand Down
2 changes: 1 addition & 1 deletion langchain-core/src/runnables/tests/runnable_remote.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* eslint-disable no-promise-executor-return */
/* eslint-disable @typescript-eslint/no-explicit-any */
import { jest, test } from "@jest/globals";
import { jest, test, expect, describe } from "@jest/globals";
import {
AIMessage,
AIMessageChunk,
Expand Down
2 changes: 1 addition & 1 deletion langchain-core/src/runnables/tests/runnable_retry.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint-disable no-promise-executor-return */
/* eslint-disable @typescript-eslint/no-explicit-any */

import { test } from "@jest/globals";
import { test, expect } from "@jest/globals";
import { RunnableLambda } from "../base.js";

test("RunnableRetry invoke", async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/* eslint-disable no-process-env */
/* eslint-disable @typescript-eslint/no-explicit-any */

import { test } from "@jest/globals";
import { test, expect, afterEach } from "@jest/globals";
import { z } from "zod";
import {
RunnableLambda,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/* eslint-disable no-process-env */
/* eslint-disable @typescript-eslint/no-explicit-any */

import { test } from "@jest/globals";
import { test, expect, afterEach } from "@jest/globals";
import { z } from "zod";
import {
RunnableLambda,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint-disable no-promise-executor-return */
/* eslint-disable @typescript-eslint/no-explicit-any */

import { test } from "@jest/globals";
import { test, expect } from "@jest/globals";
import {
ChatPromptTemplate,
HumanMessagePromptTemplate,
Expand Down
1 change: 1 addition & 0 deletions langchain-core/src/runnables/tests/runnable_tools.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { z } from "zod";
import { RunnableLambda, RunnableToolLike } from "../base.js";
import { FakeRetriever } from "../../utils/testing/index.js";
import { Document } from "../../documents/document.js";
import { test, expect } from "@jest/globals";

test("Runnable asTool works", async () => {
const schema = z.object({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
} from "../../output_parsers/base.js";
import { FakeChatModel } from "../../utils/testing/index.js";
import { getEnvironmentVariable } from "../../utils/env.js";
import { test } from "@jest/globals";

class FakeDateOutputParser extends BaseOutputParser<Date> {
lc_namespace = ["langchain_core", "output_parsers", "testing"];
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* eslint-disable no-promise-executor-return */
/* eslint-disable @typescript-eslint/no-explicit-any */
import { test } from "@jest/globals";
import { test, expect } from "@jest/globals";
import { FakeLLM } from "../../utils/testing/index.js";

test("RunnableWithFallbacks", async () => {
Expand Down
2 changes: 1 addition & 1 deletion langchain-core/src/structured_query/tests/utils.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* eslint-disable no-process-env */
import { test } from "@jest/globals";
import { test, expect } from "@jest/globals";
import { castValue, isFloat, isInt, isString } from "../utils.js";

test("Casting values correctly", () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* eslint-disable no-process-env */
import * as uuid from "uuid";
import { test } from "@jest/globals";
import { test, expect } from "@jest/globals";

import { LangChainTracer, Run } from "../tracer_langchain.js";
import { Serialized } from "../../load/serializable.js";
Expand Down
2 changes: 1 addition & 1 deletion langchain-core/src/tracers/tests/langsmith_interop.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/* eslint-disable no-process-env */
/* eslint-disable no-promise-executor-return */

import { jest } from "@jest/globals";
import { jest, test, beforeEach, afterEach, afterAll, expect } from "@jest/globals";
import { traceable } from "langsmith/traceable";

import { RunnableLambda } from "../../runnables/base.js";
Expand Down
1 change: 1 addition & 0 deletions langchain-core/src/utils/tests/enviroment.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { getRuntimeEnvironment } from "../env.js";
import { test, expect } from "@jest/globals";

test("test getRuntimeEnvironment", async () => {
const runtimeEnvironment = await getRuntimeEnvironment();
Expand Down

0 comments on commit a23bbc2

Please sign in to comment.