Qodo Documentation
HomepageBlogCommunityGet Started
  • Overview
  • Qodo Gen
  • Qodo Portal
  • Administrators Actions
  • Introduction
  • Quickstart
  • Setup and Installation
    • VSCode Installation
    • JetBrains Installation
    • Sign In
    • Extension Settings
    • Uninstall
  • Qodo Gen Chat
    • Agentic Mode
      • Agentic Tools (MCPs)
    • Standard Mode
      • Focus
        • Current File Focus
        • Git Diff Focus
      • Context
        • Add Entire Folder or Project as Context
        • Add Image as Context
      • Commands
        • /ask
        • /changelog
        • /commit
        • /describe
        • /docstring
        • /enhance
        • /explain
        • /find-on-github
        • /generate-best-practices
        • /help
        • /improve
        • /issues
        • /recap
        • /review
    • Inline Context
    • Chat History
    • Model Selection
    • Chat Preferences
  • Company Codebase (RAG)
    • Tagging
    • Configuration File
  • Code Completion
  • Test Generation
    • Configuring Your Test Setup
  • Data Sharing
  • Release Notes
Powered by GitBook
LogoLogo

Terms and Privacy

  • Terms of Use
  • Privacy Policy
  • Data Processing

© 2025 Qodo. All Rights Reserved.

On this page
  • Configuration Options
  • Configuration file example

Was this helpful?

  1. Test Generation

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:

        npx ts-mocha TEST_FILEPATH --require ./test/mocha/setup.ts
      • Jest:

        npx jest --runTestsByPath TEST_FILEPATH
    • 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

[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 = "Mocha"

# 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 = "Chai"

# A hint to the test generator about whether to use mocks or not. Possible values are true or false.
use_mocks = false

# 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 = 2


# 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.
reference_test = 
"""
describe("something", () => {
  it("says 'bar'", () => {
    // given

    // when
    const res = something.say();
   
    // Then
    expect(res).to.equal("bar");
  });
});
"""


[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 declarations that will be added at the beginning to each test file. 
overrideImports = """ 
import {expect} from 'chai'; """

Last updated 2 months ago

Was this helpful?