Configuring Your Test Setup
Qodo Gen saves test suite configurations in a TOML file at .qodo/testConfig.toml
. This ensures consistency across projects and teams.
Add .qodo/testConfig.toml
to your version control to share your test setup configuration with your team.
Configuration Options
[tests]
framework
:Description: Specifies the testing framework to be used, affecting both the content of the generated tests and the command used to run them.
Possible Values:
Python:
Pytest
,Unittest
JavaScript / TypeScript:
Jest
,Mocha
,Karma
,Jasmine
,QUnit
,React Testing Library
utility_library
:Description: An additional JavaScript utility library used for testing, if any.
Possible Values:
None
,Testing Library
,Enzyme
,Chai
.Applicability: Not applicable to Python projects.
reference_test
:Description: A multiline string, enclosed in triple quotes (
"""
), providing an example test to guide the style, setup, etc., of the generated tests.
use_mocks
:Description: Indicates whether to use mocks in the generated tests.
Possible Values:
true
,false
.
num_desired_tests
:Description: Specifies the default number of tests to be generated. Selecting fewer tests results in faster generation. Currently, this does not apply to extending test suites.
[tests.javascript]
For JavaScript / TypeScript projects, the following configuration values control the test runner:
overrideTestRunCwd
:Description: Specifies the directory to use as the "current working directory" when running JavaScript / TypeScript tests.
Default Value: The directory containing the config file.
Note: It is common practice to place the config file in the same directory as the
package.json
file and to leave this option as the default.
overrideTestRunScript
:Description: Defines the command used to run tests.
Important: Qodo Gen generates a temporary file containing the test code for a single test and runs that file. After testing, this file is deleted. For component-oriented tests, the temporary file is created next to the file being tested. For suite-extension tests, it is created next to the test suite file.
Note: You should start the command with 'npx' (e.g., 'npx jest'), and ensure the test command can run test files in the same directory as the file under test. Adjust your package.json script to avoid exclusions that could cause Qodo Gen tests to be "not found".
Placeholder:
TEST_FILEPATH
will be replaced with the actual path of the test file.Examples:
Mocha:
Jest:
Debugging Note: To debug test run issues, consult the run logs in VSCode's OUTPUT (select Qodo from the dropdown). Clearing the output before running tests again can be helpful.
overrideImports
:Description: A multiline string, enclosed in triple quotes (
"""
), containing import declarations that will be prepended to each test file.
Configuration file example
Last updated
Was this helpful?