Repository navigation
fix: resolve CI test failures across 6 packages #1077
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
Changes from all commits
9df9d77
da8db47
088209a
b98cac2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -868,7 +868,16 @@ describe('AIServicePlugin', () => { | |||||||||||||||
| }); | ||||||||||||||||
|
|
||||||||||||||||
| it('should fallback to MemoryLLMAdapter when provider SDK is not installed', async () => { | ||||||||||||||||
| const plugin = new AIServicePlugin(); | ||||||||||||||||
| // Mock all provider SDKs to simulate them not being installed. | ||||||||||||||||
| // In the workspace @ai-sdk/openai may be resolvable as a transitive | ||||||||||||||||
| // dependency, so we must explicitly make the dynamic import fail. | ||||||||||||||||
| vi.doMock('@ai-sdk/openai', () => { throw new Error('Cannot find module \'@ai-sdk/openai\''); }); | ||||||||||||||||
| vi.doMock('@ai-sdk/anthropic', () => { throw new Error('Cannot find module \'@ai-sdk/anthropic\''); }); | ||||||||||||||||
| vi.doMock('@ai-sdk/google', () => { throw new Error('Cannot find module \'@ai-sdk/google\''); }); | ||||||||||||||||
|
|
||||||||||||||||
| // Re-import the plugin module so it picks up the mocked imports | ||||||||||||||||
| const { AIServicePlugin: FreshPlugin } = await import('../plugin.js'); | ||||||||||||||||
| const plugin = new FreshPlugin(); | ||||||||||||||||
|
Comment on lines
+878
to
+880
|
||||||||||||||||
| // Re-import the plugin module so it picks up the mocked imports | |
| const { AIServicePlugin: FreshPlugin } = await import('../plugin.js'); | |
| const plugin = new FreshPlugin(); | |
| // The provider SDKs are dynamically imported during plugin initialization, | |
| // so mocking those modules is sufficient; the plugin module itself does | |
| // not need to be re-imported here. | |
| const plugin = new AIServicePlugin(); |
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.
PluginContext.getService()is specified to throw when a service is missing (and the real kernel implementations do). This mock currently returnsundefinedfor unknown services (including'data'), which can mask incorrect service lookups and makes the test context diverge from production behavior. Consider having the mock throw by default and explicitly return only the services this test intends to provide (e.g.manifest), and if AuthPlugin is meant to support “no data engine” mode, simulate that by throwing for'data'(and update the implementation accordingly).