Codium-ai / codiumai-vscode-release

266 stars 38 forks source link

Cannot run test for CRA application #140

Open iverJisty opened 9 months ago

iverJisty commented 9 months ago

Description

In application that created by create-react-app, the test will never end.

Envirionment

  1. VSCode

    Version: 1.85.1 Commit: 0ee08df0cf4527e40edc9aa28f4b5bd38bbff2b2 Date: 2023-12-13T09:47:11.635Z Electron: 25.9.7 ElectronBuildId: 25551756 Chromium: 114.0.5735.289 Node.js: 18.15.0 V8: 11.4.183.29-electron.0 OS: Linux x64 6.6.11-surface-1

  2. Codium-ai

    0.7.33

Configuration

In .codiumai.toml, I have following configuration

[tests]
framework = "Jest"
utility_library = "Testing Library"

[tests.javascript]
overrideTestRunScript = "npx react-scripts test --watchAll=false --detectOpenHandles --runTestsByPath TEST_FILEPATH"

Output in plugin

["DEBUG" - 2:20:24 PM] [RUN TESTS] [JS/TS] About to run test:
{
  "cmd": "npx react-scripts test =false --detectOpenHandles --runTestsByPath src/apis/codium_a11c4739-ece9-4062-bca7-ae66b5f4940c_auth.test.js --forceExit --coverage=false --testNamePattern \"should send a POST request to the logout endpoint\" --json",
  "cwd": "<My project root>"
}
["DEBUG" - 2:21:59 PM] [RUN TESTS] [JS/TS] Test run encountered an error. Raw results:
{
  "stdout": "{\"numFailedTestSuites\":0,\"numFailedTests\":0,\"numPassedTestSuites\":1,\"numPassedTests\":1,\"numPendingTestSuites\":0,\"numPendingTests\":0,\"numRuntimeErrorTestSuites\":0,\"numTodoTests\":0,\"numTotalTestSuites\":1,\"numTotalTests\":1,\"openHandles\":[],\"snapshot\":{\"added\":0,\"didUpdate\":false,\"failure\":false,\"filesAdded\":0,\"filesRemoved\":0,\"filesRemovedList\":[],\"filesUnmatched\":0,\"filesUpdated\":0,\"matched\":0,\"total\":0,\"unchecked\":0,\"uncheckedKeysByFile\":[],\"unmatched\":0,\"updated\":0},\"startTime\":1706509225435,\"success\":true,\"testResults\":[{\"assertionResults\":[{\"ancestorTitles\":[\"logout\"],\"failureMessages\":[],\"fullName\":\"logout should send a POST request to the logout endpoint\",\"location\":null,\"status\":\"passed\",\"title\":\"should send a POST request to the logout endpoint\"}],\"endTime\":1706509226268,\"message\":\"\",\"name\":\"<My project root>/src/apis/codium_a11c4739-ece9-4062-bca7-ae66b5f4940c_auth.test.js\",\"startTime\":1706509225761,\"status\":\"passed\",\"summary\":\"\"}],\"wasInterrupted\":false}",
  "stderr": "PASS src/apis/codium_a11c4739-ece9-4062-bca7-ae66b5f4940c_auth.test.js\n  logout\n    ✓ should send a POST request to the logout endpoint (4 ms)\n\nTest Suites: 1 passed, 1 total\nTests:       1 passed, 1 total\nSnapshots:   0 total\nTime:        0.839 s\nRan all test suites within paths \"=false\", \"src/apis/codium_a11c4739-ece9-4062-bca7-ae66b5f4940c_auth.test.js\".\n\n"
}
["DEBUG" - 2:21:59 PM] [RUN TESTS] [JS/TS] Test run succeeded with default command
{
  "resultType": "success",
  "val": {
    "results": {
      "should send a POST request to the logout endpoint": {
        "passed": true,
        "message": ""
      }
    },
    "metadata": {
      "stdout": "{\"numFailedTestSuites\":0,\"numFailedTests\":0,\"numPassedTestSuites\":1,\"numPassedTests\":1,\"numPendingTestSuites\":0,\"numPendingTests\":0,\"numRuntimeErrorTestSuites\":0,\"numTodoTests\":0,\"numTotalTestSuites\":1,\"numTotalTests\":1,\"openHandles\":[],\"snapshot\":{\"added\":0,\"didUpdate\":false,\"failure\":false,\"filesAdded\":0,\"filesRemoved\":0,\"filesRemovedList\":[],\"filesUnmatched\":0,\"filesUpdated\":0,\"matched\":0,\"total\":0,\"unchecked\":0,\"uncheckedKeysByFile\":[],\"unmatched\":0,\"updated\":0},\"startTime\":1706509225435,\"success\":true,\"testResults\":[{\"assertionResults\":[{\"ancestorTitles\":[\"logout\"],\"failureMessages\":[],\"fullName\":\"logout should send a POST request to the logout endpoint\",\"location\":null,\"status\":\"passed\",\"title\":\"should send a POST request to the logout endpoint\"}],\"endTime\":1706509226268,\"message\":\"\",\"name\":\"<My project root>/src/apis/codium_a11c4739-ece9-4062-bca7-ae66b5f4940c_auth.test.js\",\"startTime\":1706509225761,\"status\":\"passed\",\"summary\":\"\"}],\"wasInterrupted\":false}",
      "stderr": "PASS src/apis/codium_a11c4739-ece9-4062-bca7-ae66b5f4940c_auth.test.js\n  logout\n    ✓ should send a POST request to the logout endpoint (4 ms)\n\nTest Suites: 1 passed, 1 total\nTests:       1 passed, 1 total\nSnapshots:   0 total\nTime:        0.839 s\nRan all test suites within paths \"=false\", \"src/apis/codium_a11c4739-ece9-4062-bca7-ae66b5f4940c_auth.test.js\".\n\n"
    }
  }
}

The --watchAll=false seems to become =false when running the test