Skip to content

Test Runner will overwrite unity-app when "Run Test" is clicked (VSC-1670) #1536

Open
@tmrech

Description

@tmrech

OS

Linux

Operating System version

Ubuntu 24.04

Visual Studio Code version

1.99.3

ESP-IDF version

5.3.1

Python version

3.12.3

Doctor command output

report.txt

Extension

No response

Description

When using the Testrunner under the "Testing" Tab, clicking on the Play button for the first time will copy the unity-app again. This behaviour is not desirable, as it overwrites changes without warning. This will only happen the first time the Play button is clicked until the Window is Reloaded.

Steps to reproduce:

  1. Open unit_test example
  2. Create unity-app by calling ESP-IDF: Building unit test app and flashing
  3. Change something in created unity-app
  4. Go to testing tab and click "Run Test" (play button)
  5. Changes to unity-app will be overwritten
  6. Change something in unity-app again
  7. Go to testing tab and click "Run Test" (play button)
  8. Changes to unity-app will remain

Possible Solution

The runHandler in adapter.ts will always call configurePyTestUnitApp() if unitTestAppUri is not set, which will copyTestAppProject() everytime. I suppose the uri will be set after the first run.

 if (!this.unitTestAppUri) {
        const workspaceFolder = workspace.workspaceFolders
          ? workspace.workspaceFolders[0]
          : undefined;

        if (!workspaceFolder) {
          return;
        }
        this.unitTestAppUri = await configurePyTestUnitApp(
          workspaceFolder.uri,
          this.testComponents,
          cancelToken
        );
      }

Maybe a test for the existance of the unity-app should be added to the adapter runHandler or directly to the copy function.

Debug Message

none

Other Steps to Reproduce

No response

I have checked existing issues, online documentation and the Troubleshooting Guide

  • I confirm I have checked existing issues, online documentation and Troubleshooting guide.

Metadata

Metadata

Assignees

Labels

bug-reportBug Report from users on Github (don't use this tag manually, its supposed to be used via the issue)

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions