matepek / vscode-catch2-test-adapter

Catch2, Google Test and doctest Adapter for the VSCode
https://marketplace.visualstudio.com/items?itemName=matepek.vscode-catch2-test-adapter
MIT License
206 stars 52 forks source link

Catch2 nested Sections not working properly #367

Closed my-name-is-already-taken closed 1 year ago

my-name-is-already-taken commented 1 year ago

Checklist

Describe the bug When using Catch2 (v3.1.1), repeated nested sections are not displayed properly. The Problem occurs if inside of a Section, there are two parallel Sections. See the following Code and Screenshot.

To Reproduce Compile the following Unit Test. The Test "Bar" is either missing from the Test Explorer or displayed at the top level.

#include <catch2/catch_test_macros.hpp>

TEST_CASE("SomeTest")
{
   SECTION("Foo")
   {
      SECTION("Baz")
      {
         CHECK(true);
      }
      SECTION("Bar")
      {
         CHECK(true);
      }
   }
}

TEST_CASE("SomeOtherTest")
{
   CHECK(true);
}

Screenshots catch2 missing test

Desktop

Regression bug? The oldest version I could Test ist 4.3.1, where the same error occurs. In all other Versions I just get an ENOENT during test discovery

Log In the following Logs I have replaced the local paths with [PATH_TO_CPP] and [EXE_NAME].

C++ Testmate Log Output

[2022-11-16 11:15:41.017] [DEBUG] findSourceFilePath: [PATH_TO_CPP] => [PATH_TO_CPP]
[2022-11-16 11:15:41.017] [DEBUG] findSourceFilePath: [PATH_TO_CPP] => [PATH_TO_CPP]
[2022-11-16 11:15:41.018] [INFO] TestItem locaction has been updated {
  old: '[PATH_TO_CPP]',
  current: '[PATH_TO_CPP]'
}
[2022-11-16 11:15:41.018] [DEBUG] findSourceFilePath: [PATH_TO_CPP] => [PATH_TO_CPP]
[2022-11-16 11:15:41.018] [INFO] Test Foo has started.
[2022-11-16 11:15:41.019] [DEBUG] findSourceFilePath: [PATH_TO_CPP] => [PATH_TO_CPP]
[2022-11-16 11:15:41.019] [INFO] Test Baz has started.
[2022-11-16 11:15:41.019] [INFO] Test Baz has stopped.
[2022-11-16 11:15:41.019] [INFO] Test Foo has stopped.
[2022-11-16 11:15:41.019] [DEBUG] findSourceFilePath: [PATH_TO_CPP] => [PATH_TO_CPP]
[2022-11-16 11:15:41.019] [DEBUG] findSourceFilePath: [PATH_TO_CPP] => [PATH_TO_CPP]
[2022-11-16 11:15:41.020] [INFO] Test Foo has started.
[2022-11-16 11:15:41.020] [DEBUG] findSourceFilePath: [PATH_TO_CPP] => [PATH_TO_CPP]
[2022-11-16 11:15:41.020] [INFO] Test Bar has started.
[2022-11-16 11:15:41.020] [INFO] Test Bar has stopped.
[2022-11-16 11:15:41.020] [INFO] Test Foo has stopped.
[2022-11-16 11:15:41.020] [INFO] Test SomeTest has stopped.
[2022-11-16 11:15:41.021] [INFO] Test SomeOtherTest has started.
[2022-11-16 11:15:41.021] [DEBUG] findSourceFilePath: [PATH_TO_CPP] => [PATH_TO_CPP]
[2022-11-16 11:15:41.021] [DEBUG] findSourceFilePath: [PATH_TO_CPP] => [PATH_TO_CPP]
[2022-11-16 11:15:41.021] [INFO] TestItem locaction has been updated {
  old: '[PATH_TO_CPP]',
  current: '[PATH_TO_CPP]'
}
[2022-11-16 11:15:41.021] [INFO] Test SomeOtherTest has stopped.

Unit Test run Output with parameter --reporter xml

<?xml version="1.0" encoding="UTF-8"?>
<Catch2TestRun name="[EXE_NAME].exe" rng-seed="10982" catch2-version="3.1.1">
  <TestCase name="SomeTest" filename="[PATH_TO_CPP]" line="6">
    <Section name="Foo" filename="[PATH_TO_CPP]" line="8">
      <Section name="Baz" filename="[PATH_TO_CPP]" line="10">
        <OverallResults successes="1" failures="0" expectedFailures="0"/>
      </Section>
      <OverallResults successes="1" failures="0" expectedFailures="0"/>
    </Section>
    <Section name="Foo" filename="[PATH_TO_CPP]" line="8">
      <Section name="Bar" filename="[PATH_TO_CPP]" line="14">
        <OverallResults successes="1" failures="0" expectedFailures="0"/>
      </Section>
      <OverallResults successes="1" failures="0" expectedFailures="0"/>
    </Section>
    <OverallResult success="true"/>
  </TestCase>
  <TestCase name="SomeOtherTest" filename="[PATH_TO_CPP]" line="21">
    <OverallResult success="true"/>
  </TestCase>
  <OverallResults successes="3" failures="0" expectedFailures="0"/>
  <OverallResultsCases successes="2" failures="0" expectedFailures="0"/>
</Catch2TestRun>
matepek commented 1 year ago

I did copy+paste your code and I'm unable to reproduce on Mac with Version: 1.73.1 with v3.1.1.

Screenshot 2022-11-30 at 17 55 22

I can see your OS is Windows though. But very low chance that makes a difference.

A full log might would help. Or if you are committed we can have a remote debugging session.

my-name-is-already-taken commented 1 year ago

Thanks for looking into this issue. Remote debugging might prove difficult, I hope a complete log can help you:

[2022-12-01 08:05:46.035] [INFO] Deactivating extension
[2022-12-01 08:05:49.581] [INFO] Activating extension
[2022-12-01 08:05:49.582] [INFO] Activation finished
[2022-12-01 08:05:49.712] [INFO] Deactivating extension
[2022-12-01 08:05:54.231] [INFO] Activating extension
[2022-12-01 08:05:54.232] [INFO] Activation finished
[2022-12-01 08:05:55.398] [INFO] `test.advancedExecutables` is not defined. trying to use `test.executables`
[2022-12-01 08:05:55.398] [DEBUG] ExecutableConfig.resolveVariable:  {
  value: '{build,Build,BUILD,out,Out,OUT}/**/*{test,Test,TEST}*',
  resolved: Promise { <pending> },
  strictAllowed: false
}
[2022-12-01 08:05:55.400] [INFO] pattern {build,Build,BUILD,out,Out,OUT}/**/*{test,Test,TEST}* c:\test {
  isAbsolute: false,
  absPath: 'c:\\test\\{build,Build,BUILD,out,Out,OUT}\\**\\*{test,Test,TEST}*',
  isPartOfWs: true,
  relativeToWsPosix: '{build,Build,BUILD,out,Out,OUT}/**/*{test,Test,TEST}*'
}
[2022-12-01 08:05:55.462] [DEBUG] Checking file for tests: c:\test\build\test.exe
[2022-12-01 08:05:55.462] [DEBUG] Checking file for tests: c:\test\build\test.tds
[2022-12-01 08:05:55.462] [DEBUG] Checking file for tests: c:\test\build\test.ils
[2022-12-01 08:05:55.462] [DEBUG] Checking file for tests: c:\test\build\test.ilf
[2022-12-01 08:05:55.462] [DEBUG] Checking file for tests: c:\test\build\test.ild
[2022-12-01 08:05:55.462] [DEBUG] Checking file for tests: c:\test\build\test.ilc
[2022-12-01 08:05:55.462] [DEBUG] Checking file for tests: c:\test\build\CMakeFiles\test.dir\test.cpp.obj
[2022-12-01 08:05:55.462] [DEBUG] Checking file for tests: c:\test\build\.cmake\api\v1\reply\target-test-Debug-0a4dd91e91f7e4dcfb4b.json
[2022-12-01 08:05:55.462] [DEBUG] Not an executable: c:\test\build\test.tds [Error: Not a native executable extension on win32: c:\test\build\test.tds
    at e.isNativeExecutableAsync (c:\Users\[USERNAME]\.vscode\extensions\matepek.vscode-catch2-test-adapter-4.3.7\out\dist\main.js:2:378351)
    at c:\Users\[USERNAME]\.vscode\extensions\matepek.vscode-catch2-test-adapter-4.3.7\out\dist\main.js:2:265342
    at e.ConfigOfExecGroup.load (c:\Users\[USERNAME]\.vscode\extensions\matepek.vscode-catch2-test-adapter-4.3.7\out\dist\main.js:2:266242)
    at process.processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async Promise.allSettled (index 0)
    at async c:\Users\[USERNAME]\.vscode\extensions\matepek.vscode-catch2-test-adapter-4.3.7\out\dist\main.js:2:308088]
[2022-12-01 08:05:55.463] [DEBUG] Not an executable: c:\test\build\test.ils [Error: Not a native executable extension on win32: c:\test\build\test.ils
    at e.isNativeExecutableAsync (c:\Users\[USERNAME]\.vscode\extensions\matepek.vscode-catch2-test-adapter-4.3.7\out\dist\main.js:2:378351)
    at c:\Users\[USERNAME]\.vscode\extensions\matepek.vscode-catch2-test-adapter-4.3.7\out\dist\main.js:2:265342
    at e.ConfigOfExecGroup.load (c:\Users\[USERNAME]\.vscode\extensions\matepek.vscode-catch2-test-adapter-4.3.7\out\dist\main.js:2:266242)
    at process.processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async Promise.allSettled (index 0)
    at async c:\Users\[USERNAME]\.vscode\extensions\matepek.vscode-catch2-test-adapter-4.3.7\out\dist\main.js:2:308088]
[2022-12-01 08:05:55.463] [DEBUG] Not an executable: c:\test\build\test.ilf [Error: Not a native executable extension on win32: c:\test\build\test.ilf
    at e.isNativeExecutableAsync (c:\Users\[USERNAME]\.vscode\extensions\matepek.vscode-catch2-test-adapter-4.3.7\out\dist\main.js:2:378351)
    at c:\Users\[USERNAME]\.vscode\extensions\matepek.vscode-catch2-test-adapter-4.3.7\out\dist\main.js:2:265342
    at e.ConfigOfExecGroup.load (c:\Users\[USERNAME]\.vscode\extensions\matepek.vscode-catch2-test-adapter-4.3.7\out\dist\main.js:2:266242)
    at process.processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async Promise.allSettled (index 0)
    at async c:\Users\[USERNAME]\.vscode\extensions\matepek.vscode-catch2-test-adapter-4.3.7\out\dist\main.js:2:308088]
[2022-12-01 08:05:55.463] [DEBUG] Not an executable: c:\test\build\test.ild [Error: Not a native executable extension on win32: c:\test\build\test.ild
    at e.isNativeExecutableAsync (c:\Users\[USERNAME]\.vscode\extensions\matepek.vscode-catch2-test-adapter-4.3.7\out\dist\main.js:2:378351)
    at c:\Users\[USERNAME]\.vscode\extensions\matepek.vscode-catch2-test-adapter-4.3.7\out\dist\main.js:2:265342
    at e.ConfigOfExecGroup.load (c:\Users\[USERNAME]\.vscode\extensions\matepek.vscode-catch2-test-adapter-4.3.7\out\dist\main.js:2:266242)
    at process.processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async Promise.allSettled (index 0)
    at async c:\Users\[USERNAME]\.vscode\extensions\matepek.vscode-catch2-test-adapter-4.3.7\out\dist\main.js:2:308088]
[2022-12-01 08:05:55.463] [DEBUG] Not an executable: c:\test\build\test.ilc [Error: Not a native executable extension on win32: c:\test\build\test.ilc
    at e.isNativeExecutableAsync (c:\Users\[USERNAME]\.vscode\extensions\matepek.vscode-catch2-test-adapter-4.3.7\out\dist\main.js:2:378351)
    at c:\Users\[USERNAME]\.vscode\extensions\matepek.vscode-catch2-test-adapter-4.3.7\out\dist\main.js:2:265342
    at e.ConfigOfExecGroup.load (c:\Users\[USERNAME]\.vscode\extensions\matepek.vscode-catch2-test-adapter-4.3.7\out\dist\main.js:2:266242)
    at process.processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async Promise.allSettled (index 0)
    at async c:\Users\[USERNAME]\.vscode\extensions\matepek.vscode-catch2-test-adapter-4.3.7\out\dist\main.js:2:308088]
[2022-12-01 08:05:55.463] [DEBUG] Not an executable: c:\test\build\CMakeFiles\test.dir\test.cpp.obj [Error: Not a native executable extension on win32: c:\test\build\CMakeFiles\test.dir\test.cpp.obj
    at e.isNativeExecutableAsync (c:\Users\[USERNAME]\.vscode\extensions\matepek.vscode-catch2-test-adapter-4.3.7\out\dist\main.js:2:378351)
    at c:\Users\[USERNAME]\.vscode\extensions\matepek.vscode-catch2-test-adapter-4.3.7\out\dist\main.js:2:265342
    at e.ConfigOfExecGroup.load (c:\Users\[USERNAME]\.vscode\extensions\matepek.vscode-catch2-test-adapter-4.3.7\out\dist\main.js:2:266242)
    at process.processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async Promise.allSettled (index 0)
    at async c:\Users\[USERNAME]\.vscode\extensions\matepek.vscode-catch2-test-adapter-4.3.7\out\dist\main.js:2:308088]
[2022-12-01 08:05:55.463] [DEBUG] Not an executable: c:\test\build\.cmake\api\v1\reply\target-test-Debug-0a4dd91e91f7e4dcfb4b.json [Error: Not a native executable extension on win32: c:\test\build\.cmake\api\v1\reply\target-test-Debug-0a4dd91e91f7e4dcfb4b.json
    at e.isNativeExecutableAsync (c:\Users\[USERNAME]\.vscode\extensions\matepek.vscode-catch2-test-adapter-4.3.7\out\dist\main.js:2:378351)
    at c:\Users\[USERNAME]\.vscode\extensions\matepek.vscode-catch2-test-adapter-4.3.7\out\dist\main.js:2:265342
    at e.ConfigOfExecGroup.load (c:\Users\[USERNAME]\.vscode\extensions\matepek.vscode-catch2-test-adapter-4.3.7\out\dist\main.js:2:266242)
    at process.processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async Promise.allSettled (index 0)
    at async c:\Users\[USERNAME]\.vscode\extensions\matepek.vscode-catch2-test-adapter-4.3.7\out\dist\main.js:2:308088]
[2022-12-01 08:05:55.464] [DEBUG] ExecutableConfig.resolveVariable:  {
  value: '${absDirpath}',
  resolved: Promise { <pending> },
  strictAllowed: false
}
[2022-12-01 08:05:55.464] [DEBUG] ExecutableConfig.resolveVariable:  { value: {}, resolved: Promise { <pending> }, strictAllowed: true }
[2022-12-01 08:05:55.496] [INFO] reloadTests Catch2 o { major: 3, _minor: 1, _patch: 1 } c:\test\build\test.exe
[2022-12-01 08:05:55.496] [INFO] discovering tests c:\test\build\test.exe [ '[.],*', '--verbosity', 'high', '--list-tests', '--reporter', 'xml' ] c:\test\build
[2022-12-01 08:05:55.528] [DEBUG] findSourceFilePath: C:\test\test.cpp => C:\test\test.cpp
[2022-12-01 08:05:55.528] [INFO] testGrouping {
  testId: 'SomeTest',
  resolvedFile: 'C:\\test\\test.cpp',
  tags: [],
  testGrouping: { groupByExecutable: { label: undefined, description: undefined } }
}
[2022-12-01 08:05:55.530] [DEBUG] findSourceFilePath: C:\test\test.cpp => C:\test\test.cpp
[2022-12-01 08:05:55.530] [INFO] testGrouping {
  testId: 'SomeOtherTest',
  resolvedFile: 'C:\\test\\test.cpp',
  tags: [],
  testGrouping: { groupByExecutable: { label: undefined, description: undefined } }
}
[2022-12-01 08:05:57.106] [INFO] proc starting c:\test\build\test.exe [ 'SomeTest,SomeOtherTest', '--reporter', 'xml', '--durations', 'yes' ]
[2022-12-01 08:05:57.111] [INFO] proc started 15480 c:\test\build\test.exe {
  shared: {
    workspaceFolder: {
      uri: h {
        scheme: 'file',
        authority: '',
        path: '/c:/test',
        query: '',
        fragment: '',
        _formatted: 'file:///c%3A/test',
        _fsPath: 'c:\\test'
      },
      name: 'test',
      index: 0
    },
    log: s {
      configSection: 'testMate.cpp.log',
      workspaceFolder: undefined,
      outputChannelName: 'C++ TestMate',
      inspectOptions: { depth: 3 },
      includeLocation: false,
      targets: [ [c] ],
      nextInspectOptions: undefined,
      configChangeSubscription: b {
        dispose: [Function (anonymous)],
        unset: [Function (anonymous)],
        isset: [Function (anonymous)]
      }
    },
    testController: {
      controller: {
        items: [Object],
        label: [Getter/Setter],
        refreshHandler: [Getter/Setter],
        id: [Getter],
        createRunProfile: [Function: createRunProfile],
        createTestItem: [Function: createTestItem],
        createTestRun: [Function: createTestRun],
        resolveHandler: [Getter/Setter],
        dispose: [Function: dispose]
      },
      testItem2test: WeakMap { <items unknown> }
    },
    executeTask: [Function (anonymous)],
    varToValue: [
      {
        resolve: /\$\{workspaceFolder(?:\[(?:(-?[0-9]+)|(-?[0-9]+)?:(-?[0-9]+)?)\])?\}/,
        rule: [Function: rule]
      },
      {
        resolve: /\$\{workspaceDirectory(?:\[(?:(-?[0-9]+)|(-?[0-9]+)?:(-?[0-9]+)?)\])?\}/,
        rule: [Function: rule]
      },
      { resolve: '${workspaceName}', rule: 'test' },
      { resolve: /\$\{assert(?::([^}]+))?\}/, rule: [Function: rule] },
      { resolve: '${osPathSep}', rule: '\\' },
      { resolve: '${osPathEnvSep}', rule: ';' },
      { resolve: /\$\{config:([^}]+)\}/, rule: [Function: rule] },
      { resolve: /\$\{command:([^}]+)\}/, rule: [AsyncFunction: rule] }
    ],
    rngSeed: null,
    execWatchTimeout: 10000,
    _execRunningTimeout: 600000,
    execParsingTimeout: 5000,
    isNoThrow: false,
    enabledTestListCaching: false,
    enabledStrictPattern: null,
    googleTestTreatGMockWarningAs: 'nothing',
    googleTestGMockVerbose: 'default',
    hideUninterestingOutput: true,
    _execRunningTimeoutChangeEmitter: g {
      _disposed: false,
      _options: undefined,
      _leakageMon: undefined,
      _perfMon: undefined,
      _deliveryQueue: undefined,
      _event: [Function (anonymous)]
    },
    _cancellationTokenSource: y {
      _token: P { _isCancelled: false, _emitter: null },
      _parentListener: undefined
    },
    cancellationToken: P { _isCancelled: false, _emitter: null },
    onDidChangeExecRunningTimeout: [Function (anonymous)],
    taskPool: { _maxTaskCount: 1, _runningTaskCount: 1, _waitingTasks: [] },
    buildProcessChecker: {
      _log: s {
        configSection: 'testMate.cpp.log',
        workspaceFolder: undefined,
        outputChannelName: 'C++ TestMate',
        inspectOptions: [Object],
        includeLocation: false,
        targets: [Array],
        nextInspectOptions: undefined,
        configChangeSubscription: [b]
      },
      _checkIntervalMillis: 2000,
      _defaultPattern: /(^|[/\\])(cmake|make|ninja|cl|c\+\+|ld|clang|clang\+\+|gcc|g\+\+|link|icc|armcc|armclang)(-[^/\\]+)?(\.exe)?$/,
      _lastChecked: 0,
      _finishedP: Promise { undefined },
      _finishedResolver: [Function (anonymous)],
      _timerId: undefined
    }
  },
  name: undefined,
  description: undefined,
  varToValue: [
    { resolve: '${filename}', rule: 'test.exe' },
    { resolve: '${relDirpath}', rule: 'build' },
    {
      resolve: /\$\{filename(?:\[(?:(-?[0-9]+)|(-?[0-9]+)?:(-?[0-9]+)?)\])?\}/,
      rule: [Function: rule]
    },
    {
      resolve: /\$\{relPath(?:\[(?:(-?[0-9]+)|(-?[0-9]+)?:(-?[0-9]+)?)\])?\}/,
      rule: [Function: rule]
    },
    {
      resolve: /\$\{absPath(?:\[(?:(-?[0-9]+)|(-?[0-9]+)?:(-?[0-9]+)?)\])?\}/,
      rule: [Function: rule]
    },
    {
      resolve: /\$\{relDirpath(?:\[(?:(-?[0-9]+)|(-?[0-9]+)?:(-?[0-9]+)?)\])?\}/,
      rule: [Function: rule]
    },
    {
      resolve: /\$\{absDirpath(?:\[(?:(-?[0-9]+)|(-?[0-9]+)?:(-?[0-9]+)?)\])?\}/,
      rule: [Function: rule]
    },
    { resolve: '${extFilename}', rule: '.exe' },
    { resolve: '${baseFilename}', rule: 'test' },
    {
      resolve: /\$\{workspaceFolder(?:\[(?:(-?[0-9]+)|(-?[0-9]+)?:(-?[0-9]+)?)\])?\}/,
      rule: [Function: rule]
    },
    {
      resolve: /\$\{workspaceDirectory(?:\[(?:(-?[0-9]+)|(-?[0-9]+)?:(-?[0-9]+)?)\])?\}/,
      rule: [Function: rule]
    },
    { resolve: '${workspaceName}', rule: 'test' },
    { resolve: /\$\{assert(?::([^}]+))?\}/, rule: [Function: rule] },
    { resolve: '${osPathSep}', rule: '\\' },
    { resolve: '${osPathEnvSep}', rule: ';' },
    { resolve: /\$\{config:([^}]+)\}/, rule: [Function: rule] },
    { resolve: /\$\{command:([^}]+)\}/, rule: [AsyncFunction: rule] },
    {
      resolve: /\$\{cwd(?:\[(?:(-?[0-9]+)|(-?[0-9]+)?:(-?[0-9]+)?)\])?\}/,
      rule: [Function: rule]
    }
  ],
  path: 'c:\\test\\build\\test.exe',
  options: {
    cwd: 'c:\\test\\build',
    env: {
      ALLUSERSPROFILE: 'C:\\ProgramData',
      APPDATA: 'C:\\Users\\[USERNAME]\\AppData\\Roaming',
      CommonProgramFiles: 'C:\\Program Files\\Common Files',
      'CommonProgramFiles(x86)': 'C:\\Program Files (x86)\\Common Files',
      CommonProgramW6432: 'C:\\Program Files\\Common Files',
      COMPUTERNAME: '[COMPUTERNAME]',
      ComSpec: 'C:\\WINDOWS\\system32\\cmd.exe',
      ConEmuDefaultCp: '65001',
      DriverData: 'C:\\Windows\\System32\\Drivers\\DriverData',
      ELECTRON_RUN_AS_NODE: '1',
      HOMEDRIVE: 'C:',
      HOMEPATH: '\\Users\\[USERNAME]',
      LIBJABRA_TRACE_LEVEL: 'debug',
      LOCALAPPDATA: 'C:\\Users\\[USERNAME]\\AppData\\Local',
      LOGONSERVER: '\\\\[COMPUTERNAME]',
      NUMBER_OF_PROCESSORS: '8',
      OneDrive: 'C:\\Users\\[USERNAME]\\OneDrive',
      ORIGINAL_XDG_CURRENT_DESKTOP: 'undefined',
      OS: 'Windows_NT',
      Path: 'C:\\Program Files (x86)\\Embarcadero\\Studio\\22.0\\bin;C:\\Program Files (x86)\\Embarcadero\\Studio\\22.0\\bin64;C:\\WINDOWS\\System32\\Wbem;C:\\WINDOWS\\System32\\WindowsPowerShell\\v1.0\\;C:\\WINDOWS\\System32\\OpenSSH\\;C:\\_prg_\\npp;C:\\Program Files\\dotnet\\;C:\\Perl\\Strawberry\\c\\bin;C:\\Perl\\Strawberry\\perl\\site\\bin;C:\\Perl\\Strawberry\\perl\\bin;C:\\Program Files (x86)\\Windows Kits\\10\\Windows Performance Toolkit\\;C:\\Program Files\\TortoiseGit\\bin;C:\\Program Files\\TortoiseSVN\\bin;C:\\Program Files\\Git\\cmd;C:\\WINDOWS\\System32;C:\\WINDOWS\\system32;C:\\WINDOWS;C:\\Program Files\\LLVM\\bin;C:\\Users\\[USERNAME]\\AppData\\Local\\Programs\\Python\\Python310\\;C:\\Users\\[USERNAME]\\AppData\\Local\\Microsoft\\WindowsApps;C:\\Users\\[USERNAME]\\AppData\\Local\\Programs\\MiKTeX\\miktex\\bin\\x64\\;C:\\Perl\\Strawberry\\perl\\bin;C:\\Program Files\\Ninja;C:\\Program Files\\CMake\\bin;C:\\Program Files\\ccache;C:\\Users\\[USERNAME]\\AppData\\Local\\Programs\\Microsoft VS Code\\bin;',
      PATHEXT: '.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC',
      PROCESSOR_ARCHITECTURE: 'AMD64',
      PROCESSOR_IDENTIFIER: 'Intel64 Family 6 Model 140 Stepping 1, GenuineIntel',
      PROCESSOR_LEVEL: '6',
      PROCESSOR_REVISION: '8c01',
      ProgramData: 'C:\\ProgramData',
      ProgramFiles: 'C:\\Program Files',
      'ProgramFiles(x86)': 'C:\\Program Files (x86)',
      ProgramW6432: 'C:\\Program Files',
      PSModulePath: 'C:\\Program Files\\WindowsPowerShell\\Modules;C:\\WINDOWS\\system32\\WindowsPowerShell\\v1.0\\Modules',
      PUBLIC: 'C:\\Users\\Public',
      SESSIONNAME: 'Console',
      SystemDrive: 'C:',
      SystemRoot: 'C:\\WINDOWS',
      TEMP: 'C:\\Users\\DOMINI~1\\AppData\\Local\\Temp',
      TMP: 'C:\\Users\\DOMINI~1\\AppData\\Local\\Temp',
      USERDOMAIN: '[COMPUTERNAME]',
      USERDOMAIN_ROAMINGPROFILE: '[COMPUTERNAME]',
      USERNAME: '[USERNAME]',
      USERPROFILE: 'C:\\Users\\[USERNAME]',
      VSCODE_AMD_ENTRYPOINT: 'vs/workbench/api/node/extensionHostProcess',
      VSCODE_CODE_CACHE_PATH: 'C:\\Users\\[USERNAME]\\AppData\\Roaming\\Code\\CachedData\\6261075646f055b99068d3688932416f2346dd3b',
      VSCODE_CWD: 'C:\\Users\\[USERNAME]\\AppData\\Local\\Programs\\Microsoft VS Code',
      VSCODE_HANDLES_UNCAUGHT_ERRORS: 'true',
      VSCODE_IPC_HOOK: '\\\\.\\pipe\\b34cc9782d378775251371104e3a0eb8-1.73.1-main-sock',
      VSCODE_NLS_CONFIG: '{"locale":"en","availableLanguages":{},"_languagePackSupport":true}',
      VSCODE_PID: '16416',
      windir: 'C:\\WINDOWS',
      ZES_ENABLE_SYSMAN: '1'
    }
  },
  _frameworkSpecific: {},
  markAsSkipped: false,
  runTask: { before: [], beforeEach: [], after: [], afterEach: [] },
  spawner: s {},
  resolvedSourceFileMap: {},
  log: s {
    configSection: 'testMate.cpp.log',
    workspaceFolder: undefined,
    outputChannelName: 'C++ TestMate',
    inspectOptions: { depth: 3 },
    includeLocation: false,
    targets: [ c { writeStream: [WriteStream] } ],
    nextInspectOptions: undefined,
    configChangeSubscription: b {
      dispose: [Function (anonymous)],
      unset: [Function (anonymous)],
      isset: [Function (anonymous)]
    }
  },
  workspaceFolder: {
    uri: h {
      scheme: 'file',
      authority: '',
      path: '/c:/test',
      query: '',
      fragment: '',
      _formatted: 'file:///c%3A/test',
      _fsPath: 'c:\\test'
    },
    name: 'test',
    index: 0
  },
  workspacePath: 'c:\\test',
  testController: {
    controller: {
      items: {
        size: [Getter],
        forEach: [Function: forEach],
        replace: [Function: replace],
        add: [Function: add],
        delete: [Function: delete],
        get: [Function: get],
        toJSON: [Function: toJSON],
        [Symbol(Symbol.iterator)]: [Function: [Symbol.iterator]]
      },
      label: [Getter/Setter],
      refreshHandler: [Getter/Setter],
      id: [Getter],
      createRunProfile: [Function: createRunProfile],
      createTestItem: [Function: createTestItem],
      createTestRun: [Function: createTestRun],
      resolveHandler: [Getter/Setter],
      dispose: [Function: dispose]
    },
    testItem2test: WeakMap { <items unknown> }
  },
  cancellationToken: P { _isCancelled: false, _emitter: null },
  taskPool: { _maxTaskCount: 1, _runningTaskCount: 1, _waitingTasks: [] },
  executeTask: [Function (anonymous)],
  parallelizationPool: { _maxTaskCount: 1, _runningTaskCount: 1, _waitingTasks: [] }
} [ 'SomeTest,SomeOtherTest', '--reporter', 'xml', '--durations', 'yes' ];
[2022-12-01 08:05:57.132] [INFO] Test SomeTest has started.
[2022-12-01 08:05:57.133] [DEBUG] findSourceFilePath: C:\test\test.cpp => C:\test\test.cpp
[2022-12-01 08:05:57.133] [DEBUG] findSourceFilePath: C:\test\test.cpp => C:\test\test.cpp
[2022-12-01 08:05:57.133] [INFO] TestItem locaction has been updated { old: '/C:/test/test.cpp', current: '/C:/test/test.cpp' }
[2022-12-01 08:05:57.133] [DEBUG] findSourceFilePath: C:\test\test.cpp => C:\test\test.cpp
[2022-12-01 08:05:57.134] [INFO] Test Foo has started.
[2022-12-01 08:05:57.134] [DEBUG] findSourceFilePath: C:\test\test.cpp => C:\test\test.cpp
[2022-12-01 08:05:57.134] [INFO] Test Baz has started.
[2022-12-01 08:05:57.134] [INFO] Test Baz has stopped.
[2022-12-01 08:05:57.134] [INFO] Test Foo has stopped.
[2022-12-01 08:05:57.134] [DEBUG] findSourceFilePath: C:\test\test.cpp => C:\test\test.cpp
[2022-12-01 08:05:57.134] [DEBUG] findSourceFilePath: C:\test\test.cpp => C:\test\test.cpp
[2022-12-01 08:05:57.134] [INFO] Test Foo has started.
[2022-12-01 08:05:57.135] [DEBUG] findSourceFilePath: C:\test\test.cpp => C:\test\test.cpp
[2022-12-01 08:05:57.135] [INFO] Test Bar has started.
[2022-12-01 08:05:57.135] [INFO] Test Bar has stopped.
[2022-12-01 08:05:57.135] [INFO] Test Foo has stopped.
[2022-12-01 08:05:57.135] [INFO] Test SomeTest has stopped.
[2022-12-01 08:05:57.135] [INFO] Test SomeOtherTest has started.
[2022-12-01 08:05:57.135] [DEBUG] findSourceFilePath: C:\test\test.cpp => C:\test\test.cpp
[2022-12-01 08:05:57.135] [DEBUG] findSourceFilePath: C:\test\test.cpp => C:\test\test.cpp
[2022-12-01 08:05:57.135] [INFO] TestItem locaction has been updated { old: '/C:/test/test.cpp', current: '/C:/test/test.cpp' }
[2022-12-01 08:05:57.135] [INFO] Test SomeOtherTest has stopped.
[2022-12-01 08:05:57.136] [INFO] proc close: c:\test\build\test.exe [ 0, null ]
[2022-12-01 08:05:57.137] [INFO] proc finished: c:\test\build\test.exe
matepek commented 1 year ago

Sadly, it is not.. :/ It is very hard to imagine that there is a platform dependent bug somewhere..

my-name-is-already-taken commented 1 year ago

I have tried debugging this problem by myself and observed the following in the function createOrReplace of the TestItemManager: When the second "Foo" Test starts, the Item "SomeTest" has the child "Foo" with further subchild "Baz". Then the existing "Foo" Item is deleted and replaced with a new, empty "Foo" Item. This Item is then subsequently filled with a child "Bar".

Now I modified the code in the createOrReplace function to first check for an existing Item an then returning the Item immediately in this case. This solved the problem, but I assume that this breaks something else? I'm not quite sure about all the cases this function covers.

However, I was also able to determine why this bug only occurs on windows. In the update function of the TestItemManager, the value of item.uri?.path is "/C:/test/test.cpp", while the resolvedFile is "C:\test\test.cpp". Indeed, I was also able to resolve the problem by first converting resolvedFile to a vscode.Uri and then comparing the two path properties.

matepek commented 1 year ago
Fixed in v4.3.8. This issue was mentioned in [CHANGELOG.md](./CHANGELOG.md) under a released entry so it is assumed to be fixed. User verifications are always welcome.
matepek commented 1 year ago

Nice work. Please verify it is working now.

my-name-is-already-taken commented 1 year ago

There is still a problem. Now the value of item.uri?.fsPath is "c:\test\test.cpp", while the value of resolvedFile is "C:\test\test.cpp". Windows filenames must (unfortunately) be compared case insentive.

matepek commented 1 year ago

right..

matepek commented 1 year ago
Fixed in v4.3.10. This issue was mentioned in [CHANGELOG.md](./CHANGELOG.md) under a released entry so it is assumed to be fixed. User verifications are always welcome.
my-name-is-already-taken commented 1 year ago

I can confirm,this has fixed the issue. Thanks a lot!