fix: run bedrock-kb store test in node only#2966
Merged
opieter-aws merged 1 commit intoJun 25, 2026
Merged
Conversation
Contributor
|
Assessment: Comment (lean approve) Clean, minimal, correctly-scoped fix. The 100% rename moves the AWS-SDK-mocking suite into the Review notes
Nice, well-written PR description that made the root cause easy to follow. |
notowen333
approved these changes
Jun 25, 2026
9 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
bedrock-knowledge-base-store.test.tsmocks the AWS SDK clients (@aws-sdk/client-bedrock-agent-runtime,@aws-sdk/client-bedrock-agent,@aws-sdk/client-s3) withvi.mockand, in four of its cases, asserts on the mocked constructor — e.g.expect(vi.mocked(BedrockAgentRuntimeClient)).toHaveBeenCalledWith({}). Under theunit-browser(chromium) project, the AWS-SDK module mock isn't applied the way it is in Node, so the importedBedrockAgentRuntimeClientis the real class rather than avi.fn(), and the assertion throwsTypeError: [Function BedrockAgentRuntimeClient] is not a spy or a call to a spy!.Because the file is named
*.test.ts, vitest runs it in both theunit-nodeandunit-browserprojects (seevitest.config.ts). The constructor-spy assertions only make sense in Node, where the SDK mock takes effect — exercising Node AWS SDK client construction has no meaning in a browser environment. This is purely a test-environment mismatch; the store itself is unaffected.The fix renames the file to
bedrock-knowledge-base-store.test.node.ts, which the config scopes tounit-nodeonly (theunit-browserproject includes*.test.ts/*.test.browser.ts, not*.test.node.ts). This matches the repository convention for Node-only tests documented instrands-ts/docs/TESTING.md.Related Issues
None.
Documentation PR
Not applicable.
Type of Change
Bug fix
Testing
Ran the affected suites locally after the rename:
npx vitest run --project unit-node …/bedrock-knowledge-base-store.test.node.ts→ 70/70 passed.npx vitest list --project unit-browser→ the file is no longer collected by the browser project (so the chromium failure can't recur).I ran
hatch run prepareChecklist
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.