-
Notifications
You must be signed in to change notification settings - Fork 0
/
.codiumai.toml
123 lines (110 loc) · 4.91 KB
/
.codiumai.toml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
#.codiumai.toml
[tests]
## Testing framework to use - this can affect the content of the generated tests
## as well as the test run command.
## Possible values are:
## Python: Pytest, Unittest
## Javascript / Typescript: Jest, Mocha, Vitest, Karma, Jasmine, QUnit, React Testing Library
## HOWEVER: running tests in JS / TS is at the moment only supported
## for Jest, Mocha, Vitest, and React Testing Library
framework = "Unittest"
## An additional Javascript utility library used to test your code, if any.
## Possible values are None, Testing Library, Enzyme, or Chai. Not applicable to Python projects.
# utility_library = "Testing Library"
## A hint to the test generator about whether to use mocks or not. Possible values are true or false.
use_mocks = true
## How many tests should be generated by default. Fewer tests is faster.
## Does not apply at the moment to extend-suite tests.
# num_desired_tests = 6
## A multiline string, delimited with triple-quotes (""") serving as an extra instruction
## that the AI model will take into consideration.
## This will appear as "General instructions" in the
## configuration section in the tests panel.
# plan_instructions = """
# Each line should have a comment explaining it.
# Each comment should start with the comment number (1., 2. etc.)
# """
plan_instructions = """
1. for test names use the original function name prefixed with 'test_'.
2. mock/stub everything!
3. make sure that the original db file is not overwritten.
4. make sure all code in the file is covered by tests.
5. make sure that stub models are valid so conform to the model schema.
6. So Project takes: 'name', 'domain', and Service takes: 'name', 'port'.
7. don't use 'with mock.patch(' but inject all mocks with annotations and expect them to be ready, like in the example.
"""
## A multiline string, delimited with triple-quotes (""") serving as an example test that represents
## what you would like the generated tests to look like in terms of style, setup, etc.
# example_test = """
# describe("something", () => {
# it("says 'bar'", () => {
# // given
#
# // when
# const res = something.say();
#
# // Then
# expect(res).to.equal("bar");
# });
# });
# """
example_test = """
@mock.patch("os.scandir")
@mock.patch("lib.upstream.update_upstream")
def test_update_upstreams(self, mock_update_upstream: Mock, mock_scandir: Mock):
mock_scandir.return_value = [DirEntry("upstream/my-project")]
# Call the function under test
update_upstreams()
mock_update_upstream.assert_called_once_with(
"my-project",
False,
)
"""
[tests.javascript]
## When running Javascript / Typescript tests, use this directory as the test process "current working directory".
## This is a path relative to the location of the config file.
## Default: The directory containing the config file.
## Note: the typical setup is to place the config file in the same directory as the relevant 'package.json' file,
## and leave this commented-out.
# overrideTestRunCwd = "./test"
## This is the command that's used to run tests.
## PLEASE READ CAREFULLY:
##
## When running tests, CodiumAI generates a temporary file that contains the test code for a single test,
## and runs that file.
## When the tests are done, the temporary file is deleted.
## For component-oriented tests (when you click "test this class" or "test this function"), the temporary file
## is created next to the file being tested.
## For extend-suite tests (when you click "add more tests" on a test-suite), the temporary file is created next
## to the test-suite file.
##
## Typically, you're going to want to take the test script defined in your package.json file, and tweak it a
## little to make it compatible with CodiumAI.
##
## You almost always want to start with 'npx' (e.g. 'npx jest', not 'npm jest' or 'yarn test').
##
## Note that the test command must be able to run test files that are located in the same directory as the
## file under test.
## A common issue is that the test command in the package.json file selects only from
## a "tests" directory, causing the CodiumAI tests be "not found" - please remove any such restriction from
## the command / configuration.
##
## The placeholder TEST_FILEPATH will be replaced with the actual test file path - this is how we find
## the file to run.
##
## EXAMPLES:
## Mocha:
## npx ts-mocha TEST_FILEPATH --require ./test/mocha/setup.ts
## Jest:
## npx jest --runTestsByPath TEST_FILEPATH
##
## DEBUGGING NOTE:
## To help debug run-tests issues, you can view run logs in vscode's OUTPUT
## (select codium-ai from the dropdown).
## It's helpful to clear the output (right-click -> clear) and then run the tests again.
##
# overrideTestRunScript = "npx jest --runTestsByPath TEST_FILEPATH"
## A multiline string, delimited with triple-quotes ("""),
## containing import declaration to use in each test file.
# overrideImports = """
# import {expect} from 'chai'; """