-
Notifications
You must be signed in to change notification settings - Fork 749
fix(amazonq): Updating logic for getWorkspaceRelativePath in shared src for /test #6628
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
|
|
Discussed the PR offline to check the conditions, this fix works for test generation. |
| } | ||
| for (const folder of override.workspaceFolders) { | ||
| let folders = override.workspaceFolders | ||
| if (useCase && useCase === FeatureUseCase.TEST_GENERATION) { |
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.
This feels too specific to be put in this shared utility method. Are you planning to update this later?
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.
Yes Will remove this once I get confirmation from Q teams
For now this is required for UTG. I think this is the same case for other features too
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.
Can you track this in an issue somewhere so that someone comes back to it. This workspace util is become a monster 😞
| } | ||
| for (const folder of override.workspaceFolders) { | ||
| let folders = override.workspaceFolders | ||
| if (useCase && useCase === FeatureUseCase.TEST_GENERATION) { |
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.
Can just do
| if (useCase && useCase === FeatureUseCase.TEST_GENERATION) { | |
| if (useCase === FeatureUseCase.TEST_GENERATION) { |
|
|
||
| for (const file of files) { | ||
| const relativePath = getWorkspaceRelativePath(file.fsPath, { workspaceFolders }) | ||
| const relativePath = getWorkspaceRelativePath(file.fsPath, { workspaceFolders }, useCase) |
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.
This is already filterFn, why was this special parameter needed?
Problem
Target file doesn't exist or is a directory.issue in unit test generation./testthen in shared workspaceUtils:aws-toolkit-vscode/packages/core/src/shared/utilities/workspaceUtils.ts
Lines 220 to 236 in 35502be
Solution
Given above function with workspaceFolders as
User requires the project/folder with path: "/Users/Q/Downloads/TestingUTG/Sample/src/Sample" but right now this gives the path from "/Users/Q/Downloads/TestingUTG/Sample/src" which incorrectly collects the files and this is causing failures in Unit test generation.
Example:
Expected Payload is
but actual payload is
TODO:
feature/xbranches will not be squash-merged at release time.