vscode-jest
vscode-jest copied to clipboard
Clear test results on test execution?
Environment
vscode-jest version: 6.0.1node -v: 14.17.0npm -voryarn --version: yarn 1.22.19npm ls jestornpm ls react-scripts(if you haven’t ejected): [fill]- your vscode-jest settings if customized:
- jest.autoRun? off
- jest.debugMode: true
- jest.monitorLongRun: off
- jest.autoClearTerminal: true
- jest.virtualFolders : [{name: "somename", jestCommandLine: "/home/somePath/node_modules/jest/bin/jest.js --config=... "}]
- anything else that you think might be relevant? [fill]
- Operating system: RHEL 9
Would it be possible to clear previous test results (or make it configurable) when I start new test execution? What I mean is the right column in TEST RESULTS bottom panel. I'd find it much easier to use if the content of the history would be cleared anytime I trigger some tests. So essentially the desired state is to have history of size 1, aka latest test run only
This is controlled by vscode testing subsystem, cc @connor4312 for insight.
We could have a setting for this; if more users request it we could go that direction. An extension could also manually run the testing.clearTestResults command.
@connor4312 good point, we can try testing.clearTestResults upon starting new tests.
One potential issue though: In a multi-root workspace environment, this will mean one run from a given folder will clear out the output from other folders... is there a way to close out the output associated with the specific controllers?
That's right--unfortunately no command to clear a specific controller's output.
Having it hidden behind some settings would be great :)
Personally I don't really care about history of test runs - in my workflow, I don't really remember what exactly was different (either in application code or test code) in previous test executions so seeing different results brings zero value
Yea, I think some testing.historyEnabled would be the right solution here. I would want to see if there's interest from more people here before taking the time to implement it (though I would take a PR)
@connor4312 Challenge accepted :) I have the changes ready (I hope) - will do some more testing and prepare PR today :)
sounds good 🙂
@connor4312 Here's the PR https://github.com/jest-community/vscode-jest/pull/1071 , hopefully somewhat meaningful - as stated in the PR's description, I did not bumped version in package.json and I kind of "guessed" the version in README.md file - not sure how to do it better? Thank you
Oh, sorry. I was speaking to the VS Code side of things; I'm not a maintainer of the Jest extension. @connectdotz can weigh in on that PR. Code pointers for VS code if you opt to contribute there:
- Where configuration for testing is defined https://github.com/microsoft/vscode/blob/01c88cc99efcd423d662b56941f029bd22c4d584/src/vs/workbench/contrib/testing/common/configuration.ts
- Random example of reading configuration https://github.com/microsoft/vscode/blob/01c88cc99efcd423d662b56941f029bd22c4d584/src/vs/workbench/contrib/testing/browser/testingProgressUiService.ts#L38
- Where results get inserted (could clear out complete results when a new result is inserted with the setting enabled) https://github.com/microsoft/vscode/blob/01c88cc99efcd423d662b56941f029bd22c4d584/src/vs/workbench/contrib/testing/common/testResultService.ts#L171
No worries and sorry for the misunderstanding. I somehow managed to make the changes (unless proven otherwise in PR :))
@connor4312 after playing with testing.clearTestResults command, I am not sure that is what we are looking for. The command not only clears the test results and history in the panel, it also removes the status of all the test items. Did I miss something? I think we are looking for a way to clear just the output and the history of the runs, not the actual status of the tests.
reopen this issue to remind us when a better clear test-results panel command becomes available.
The state of items is intrinsically linked to the history: the state of any given item is that of its most recent test run. There is not a way to keep states but remove the history, or vise versa.