Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Running tests with vitest fails #150

Open
eikowagenknecht opened this issue Mar 1, 2024 · 0 comments
Open

Running tests with vitest fails #150

eikowagenknecht opened this issue Mar 1, 2024 · 0 comments

Comments

@eikowagenknecht
Copy link

eikowagenknecht commented Mar 1, 2024

I understand that the Vitest support has been temporarily "disabled" by removing it from the config window, but it's still documented in the codiumai.toml file and seems to do things. But unfortunately running the tests does not work, even though in my case they are generated correctly.

["DEBUG" - 5:06:08 PM] [CONFIG] Reading config, starting from directory
{
  "currentDir": "c:\\Entwicklung\\repos\\*****\\src\\services\\scheduler",
  "currDirResolved": "c:\\Entwicklung\\repos\\*****\\src\\services\\scheduler"
}
["DEBUG" - 5:06:08 PM] [CONFIG] Discovered and parsed config file
{
  "codiumFile": "c:\\Entwicklung\\repos\\*****\\.codiumai.toml",
  "parsedConfig": {
    "tests": {
      "type": "section",
      "filePath": "c:\\Entwicklung\\repos\\*****\\.codiumai.toml",
      "entries": {
        "framework": {
          "type": "value",
          "filePath": "c:\\Entwicklung\\repos\\*****\\.codiumai.toml",
          "value": "Vitest"
        },
        "utility_library": {
          "type": "value",
          "filePath": "c:\\Entwicklung\\repos\\*****\\.codiumai.toml",
          "value": "Testing Library"
        },
        "javascript": {
          "type": "section",
          "filePath": "c:\\Entwicklung\\repos\\*****\\.codiumai.toml",
          "entries": {}
        }
      }
    }
  }
}
["DEBUG" - 5:06:08 PM] [CONFIG] Reading config, starting from directory
{
  "currentDir": "c:\\Entwicklung\\repos\\*****\\src\\services\\scheduler",
  "currDirResolved": "c:\\Entwicklung\\repos\\*****\\src\\services\\scheduler"
}
["DEBUG" - 5:06:08 PM] [CONFIG] Discovered and parsed config file
{
  "codiumFile": "c:\\Entwicklung\\repos\\*****\\.codiumai.toml",
  "parsedConfig": {
    "tests": {
      "type": "section",
      "filePath": "c:\\Entwicklung\\repos\\*****\\.codiumai.toml",
      "entries": {
        "framework": {
          "type": "value",
          "filePath": "c:\\Entwicklung\\repos\\*****\\.codiumai.toml",
          "value": "Vitest"
        },
        "utility_library": {
          "type": "value",
          "filePath": "c:\\Entwicklung\\repos\\*****\\.codiumai.toml",
          "value": "Testing Library"
        },
        "javascript": {
          "type": "section",
          "filePath": "c:\\Entwicklung\\repos\\*****\\.codiumai.toml",
          "entries": {}
        }
      }
    }
  }
}
["DEBUG" - 5:06:08 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",
  "cwd": "c:\\Entwicklung\\repos\\*****"
}
["DEBUG" - 5:06:10 PM] [RUN TESTS] [JS/TS] Test run encountered an error. Raw results:
{
  "stdout": "\n♻️  Generating routes...\n✅ Processed routes in 141ms\n{\"numTotalTestSuites\":2,\"numPassedTestSuites\":0,\"numFailedTestSuites\":2,\"numPendingTestSuites\":0,\"numTotalTests\":0,\"numPassedTests\":0,\"numFailedTests\":0,\"numPendingTests\":0,\"numTodoTests\":0,\"startTime\":1709309169646,\"success\":false,\"testResults\":[{\"assertionResults\":[],\"startTime\":1709309169646,\"endTime\":1709309169646,\"status\":\"failed\",\"message\":\"No test suite found in file c:/Entwicklung/repos/*****/src/services/scheduler/codium_7ae57d6b-402a-4ac0-ba70-0357f0e49f4f_daily.test.test.ts\",\"name\":\"c:/Entwicklung/repos/*****/src/services/scheduler/codium_7ae57d6b-402a-4ac0-ba70-0357f0e49f4f_daily.test.test.ts\"},{\"assertionResults\":[],\"startTime\":1709309169646,\"endTime\":1709309169646,\"status\":\"failed\",\"message\":\"No test suite found in file c:/Entwicklung/repos/*****/src/services/scheduler/daily.test.ts\",\"name\":\"c:/Entwicklung/repos/*****/src/services/scheduler/daily.test.ts\"}]}\n",
  "stderr": ""
}
["DEBUG" - 5:06:10 PM] [RUN TESTS] [JS/TS] Test run failed with default command. Attempting running with fallback command.
["DEBUG" - 5:06:10 PM] [RUN TESTS] [JS/TS] About to run test:
{
  "cmd": "npx vitest run src\\services\\scheduler\\codium_7ae57d6b-402a-4ac0-ba70-0357f0e49f4f_daily.test.test.ts --dir \"src\\services\\scheduler\" --testNamePattern \"should return true when reviews are undefined\" --reporter json",
  "cwd": "c:\\Entwicklung\\repos\\*****"
}
["DEBUG" - 5:06:12 PM] [RUN TESTS] [JS/TS] Test run encountered an error. Raw results:
{
  "stdout": "\n♻️  Generating routes...\n✅ Processed routes in 140ms\n{\"numTotalTestSuites\":1,\"numPassedTestSuites\":0,\"numFailedTestSuites\":1,\"numPendingTestSuites\":0,\"numTotalTests\":0,\"numPassedTests\":0,\"numFailedTests\":0,\"numPendingTests\":0,\"numTodoTests\":0,\"startTime\":1709309171561,\"success\":false,\"testResults\":[{\"assertionResults\":[],\"startTime\":1709309171561,\"endTime\":1709309171561,\"status\":\"failed\",\"message\":\"No test suite found in file c:/Entwicklung/repos/*****/src/services/scheduler/codium_7ae57d6b-402a-4ac0-ba70-0357f0e49f4f_daily.test.test.ts\",\"name\":\"c:/Entwicklung/repos/*****/src/services/scheduler/codium_7ae57d6b-402a-4ac0-ba70-0357f0e49f4f_daily.test.test.ts\"}]}\n",
  "stderr": ""
}
["DEBUG" - 5:06:12 PM] [RUN TESTS] [JS/TS] Test run failed with both default and fallback command. Returning default command results
["DEBUG" - 5:06:12 PM] [CONFIG] Reading config, starting from directory
{
  "currentDir": "c:\\Entwicklung\\repos\\*****\\src\\services\\scheduler",
  "currDirResolved": "c:\\Entwicklung\\repos\\*****\\src\\services\\scheduler"
}
["DEBUG" - 5:06:12 PM] [CONFIG] Discovered and parsed config file
{
  "codiumFile": "c:\\Entwicklung\\repos\\*****\\.codiumai.toml",
  "parsedConfig": {
    "tests": {
      "type": "section",
      "filePath": "c:\\Entwicklung\\repos\\*****\\.codiumai.toml",
      "entries": {
        "framework": {
          "type": "value",
          "filePath": "c:\\Entwicklung\\repos\\*****\\.codiumai.toml",
          "value": "Vitest"
        },
        "utility_library": {
          "type": "value",
          "filePath": "c:\\Entwicklung\\repos\\*****\\.codiumai.toml",
          "value": "Testing Library"
        },
        "javascript": {
          "type": "section",
          "filePath": "c:\\Entwicklung\\repos\\*****\\.codiumai.toml",
          "entries": {}
        }
      }
    }
  }
}

But when I grab the temp file content (which contains most things twice, but is still valid enough), save it as codiumextracted.test.ts and run the command myself, it works just fine:

import { describe, expect, it, assert, suite, should, test } from 'vitest';

import { it, expect, describe } from "vitest";
import DailyScheduler from "./daily";

// Returns true if reviews are undefined or empty.
describe("isDue", () => {
  it("should return true when reviews are undefined", () => {
    const scheduler = new DailyScheduler();
    const result = scheduler.isDue(undefined);
    expect(result).toBe(true);
  });
});


// Generated by CodiumAI

describe("isDue", () => {

    // should return true when reviews are undefined
    it("should return true when reviews are undefined", () => {
      const scheduler = new DailyScheduler();
      const result = scheduler.isDue(undefined);
      expect(result).toBe(true);
    });
});
PS C:\Entwicklung\repos\*****> npx vitest run src\services\scheduler\codiumextracted.test.ts --testNamePattern "should return true when reviews are undefined" --reporter json  

♻️  Generating routes...
✅ Processed routes in 138ms
{"numTotalTestSuites":3,"numPassedTestSuites":3,"numFailedTestSuites":0,"numPendingTestSuites":0,"numTotalTests":2,"numPassedTests":2,"numFailedTests":0,"numPendingTests":0,"numTodoTests":0,"startTime":1709309405282,"success":true,"testResults":[{"assertionResults":[{"ancestorTitles":["","isDue"],"fullName":" isDue should return true when reviews are undefined","status":"passed","title":"should return true when reviews are undefined","duration":0,"failureMessages":[]},{"ancestorTitles":["","isDue"],"fullName":" isDue should return true when reviews are undefined","status":"passed","title":"should return true when reviews are undefined","duration":0,"failureMessages":[]}],"startTime":1709309405931,"endTime":1709309405931,"status":"passed","message":"","name":"C:/Entwicklung/repos/*****/src/services/scheduler/codiumextracted.test.ts"}]}
PS C:\Entwicklung\repos\*****> 

Running this on a Windows box.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant