-
Notifications
You must be signed in to change notification settings - Fork 2.8k
test(anthropic): migrate to Vitest #8632
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
1 Skipped Deployment
|
97486df
to
671c09f
Compare
51e040b
to
bcd64f0
Compare
bcd64f0
to
772ee08
Compare
test("ChatAnthropicStandardIntegrationTests", async () => { | ||
const testResults = await testClass.runTests(); | ||
expect(testResults).toBe(true); | ||
}); | ||
testClass.runTests("ChatAnthropicStandardIntegrationTests"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
standard tests doesn't enclose test suites inside of a test block, so I'm pretty sure this will cause false positives
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
standard tests doesn't enclose test suites inside of a test block, so I'm pretty sure this will cause false positives
@hntrl the Vitest export of this package does see
langchainjs/libs/langchain-standard-tests/src/unit_tests/vitest.ts
Lines 27 to 48 in 4fcd605
/** | |
* Run all unit tests for the chat model. | |
* Each test is wrapped in a try/catch block to prevent the entire test suite from failing. | |
* If a test fails, the error is logged to the console, and the test suite continues. | |
* @returns {boolean} | |
*/ | |
runTests(testName = "ChatModelUnitTests") { | |
describe(testName, () => { | |
test("should initialize chat model successfully", () => | |
this.testChatModelInit()); | |
test("should initialize chat model with API key", () => | |
this.testChatModelInitApiKey()); | |
test("should initialize chat model with streaming enabled", () => | |
this.testChatModelInitStreaming()); | |
test("should bind tools when tool calling is supported", () => | |
this.testChatModelWithBindTools()); | |
test("should work with structured output when supported", () => | |
this.testChatModelWithStructuredOutput()); | |
test("should return standard LangSmith parameters", () => | |
this.testStandardParams()); | |
}); | |
} |
The reason for this is that previous behavior would log an error but would throw away stack traces and diffs.
test("ChatAnthropicStandardUnitTests", () => { | ||
const testResults = testClass.runTests(); | ||
expect(testResults).toBe(true); | ||
}); | ||
testClass.runTests("ChatAnthropicStandardUnitTests"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here
Co-authored-by: Hunter Lovell <[email protected]>
Co-authored-by: Hunter Lovell <[email protected]>
Co-authored-by: Hunter Lovell <[email protected]>
Migrating
@langchain/anthropic
to Vitest.