jest-community / vscode-jest

The optimal flow for Jest based testing in VS Code
MIT License
2.84k stars 294 forks source link

feat: add clearTestResults option #1071

Closed ladariha closed 1 year ago

ladariha commented 1 year ago

Adds option to clear test results on new test run as discussed in https://github.com/jest-community/vscode-jest/issues/1060

connectdotz commented 1 year ago

@ladariha Thanks for the PR. A few things come to mind:

  1. we already have a setting jest.autoClearTerminal, not sure if we should create yet another setting to control the test results tab. Maybe we can rename the settings to autoClearOutput so it applies to both?
  2. We are in the process of cleaning up and better organizing the settings (they are getting harder to discover). I am thinking maybe we should move this autoClearOutput to the new runMode (#1058), given the revealOutput is already there.
  3. Also, it seems you only check it in the test-provider runTests(), which is triggered by UI/TestExplorer. But we also have background auto-runs that will not go through test-provider. You can take a look at how autoClearTerminal was implemented (#1014) to get some idea.
  4. There is also a separate thread about better supporting the Test Results tab (#1051). Considering these Test Results tab related issues, I am wondering if we should expand the jest.TestExplorer setting to add a new option useTestResults: boolean. If false, we will just hide the test results tab; if true, then the output content and settings should just apply to both the terminal and the test-results tab...

Anyway, as you can see there are a few options for this feature. Feel free to join the discussion (#1058) so we can discuss further.

ladariha commented 1 year ago

I apologize for long response time. I more than happy to merge the feature with autoClearTerminal and also the background auto-runs issue you mentioned. Please give me a week to finish it

Regarding the point 2 and 4

connectdotz commented 1 year ago

The change I listed above is definitely too broad for this PR. I am working on an output overhaul PR to address them, which will include clearing output for the terminal and/or test-results panel, along with other changes. I can ping you for testing/discussion if you are interested.