sourcegraph / cody

Type less, code more: Cody is an AI code assistant that uses advanced search and codebase context to help you write and fix code.
https://cody.dev
Apache License 2.0
2.3k stars 219 forks source link

bug: "Generate Tests" generates a valid test but missing `import` statement #3963

Open noah-berman opened 2 months ago

noah-berman commented 2 months ago

Version

v1.15.1714144471 (pre-release)

Describe the bug

Customer has reported that, for both sample TypeScript and Python files, "Generate Tests" has correctly populated valid unit tests, but instead of adding an import statement at the top of the file it simply lists the path of the new test file:

image image

Expected behavior

Test file should have an import statement to correctly import the function/method in question

Additional context

Customer is using Cody Pro with freshly spun-up TypeScript and Python repositories for testing. Client has tried switching LLMs across Sonnet, Opus, GPT-3.5 Turbo, and GPT-4 Turbo

sqs commented 2 months ago

Notes:

umpox commented 2 months ago
abeatrix commented 2 months ago

@umpox we have a newTestSuitePrompt that specifically asked the LLM not to include any imports if there is an existing test file, since the new test suite is appended to the file. Maybe we can remove it to support "add all missing imports"?