Codium-ai / codiumai-vscode-release

266 stars 38 forks source link

Config override adds additional unsupported parameters #149

Open eikowagenknecht opened 8 months ago

eikowagenknecht commented 8 months ago

So I set my .codiumai.toml to this:

[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 vitest run TEST_FILEPATH"

But the actual command that is run is

["DEBUG" - 4:57:27 PM] [RUN TESTS] [JS/TS] About to run test:
{
  "cmd": "npx vitest run src\\services\\scheduler\\codium_19b202e9-d1fb-4650-95ed-747fd84118fd_daily.test.ts --json",

which leads to vitest crashing:

file:///c:/Entwicklung/repos/diana-cards/node_modules/vitest/dist/vendor/cac.wWT9ELdg.js:513
          throw new CACError(`Unknown option \`${name.length > 1 ? `--${name}` : `-${name}`}\``);
                ^

CACError: Unknown option `--json`
    at Command.checkUnknownOptions (file:///c:/Entwicklung/repos/***/node_modules/vitest/dist/vendor/cac.wWT9ELdg.js:513:17)
    at CAC.runMatchedCommand (file:///c:/Entwicklung/repos/***/node_modules/vitest/dist/vendor/cac.wWT9ELdg.js:713:13)
    at CAC.parse (file:///c:/Entwicklung/repos/***/node_modules/vitest/dist/vendor/cac.wWT9ELdg.js:654:12)
    at file:///c:/Entwicklung/repos/***/node_modules/vitest/dist/cli.js:67:13
    at ModuleJob.run (node:internal/modules/esm/module_job:218:25)
    at async ModuleLoader.import (node:internal/modules/esm/loader:329:24)
    at async main (file:///c:/Entwicklung/repos/***/node_modules/vitest/dist/cli-wrapper.js:45:5)

Without the setting set, it automatically runs

["DEBUG" - 5:00:46 PM] [RUN TESTS] [JS/TS] About to run test:
{
  "cmd": "npx vitest run --dir \"src\\services\\scheduler\" --testNamePattern \"should return true when reviews are undefined\" --reporter json",

(which also fails, see #150)

Samuel-Morgan-Tyghe commented 1 month ago

@almog-lv @OmriGM Any progress on this?

its easy to replace FILE_PATH with just the filepath

npx vitest run ExampleDirectory/example.test.tsx would work

Samuel-Morgan-Tyghe commented 3 weeks ago

Bump ^