UT Gen Copilot
Generate unit tests for TypeScript using GPT
Configurations
GPT configs
Option 1: Use Github Copilot (RECOMMONED)
Install and setup Github Copilot, and allow our extensions to use Github copilot.
Option 2: Use your own model
Press Ctrl+, to open the settings page, search for utcop, and set the configurations.
We suggest setting up GPT authentication using a token API. We use the token API in the extension as described here: How to configure Azure OpenAI Service with Microsoft Entra ID authentication - Azure OpenAI | Microsoft Learn.
You can also use a GPT key for authentication.
The GPT key has a higher priority than the token API. If you want to use the token API, please delete the GPT key and restart VSCode.
Common configs
saveFailed
Default to false. Save the failed generation file, e.g. “foo.failed.spec.ts” to help check the cause of the failure.
packageRegex
If you set a regex, unmatched packages will be skipped.
createIndexSpec
Default to false.
Set to true to create an empty spec file for the files that only exported constants or types.
ignoreFuncs
List of functions to ignore.
mockDependencies
A map to set mock code for dependencies.
If you want to reset to default map, open settings.json and delete utCopilot.common.mockDependencies
Rules:
foo to ignore function foo
Foo.bar to ignore function bar in class Foo
*.foo to ignore function foo in all classes
Foo.* to ignore all functions in class Foo
Check debug log
Press Ctrl+~, switch to the OUTPUT tab, find UTCopilot