-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[vscode] Add support for TestRunProfile onDidChangeProfile event #13388
Conversation
6ae403b
to
c5ad6a9
Compare
@@ -2173,6 +2173,9 @@ export interface TestingExt { | |||
/** Configures a test run config. */ | |||
$onConfigureRunProfile(controllerId: string, profileId: string): void; | |||
|
|||
/** Sets the default on a given run profile */ | |||
$onChangeDefault(controllerId: string, profileId: string, isDefault: boolean): void; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not really correct according to our naming conventions ("onDidChange..."), but 1. it's consistent with the rest of the interface and 2. I invented it 🤦 .
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I changed the naming in favor of the onDid..., that seems indeed more inline with the usual naming in Theia.
private onDidChangeDefaultEmitter = new Emitter<boolean>(); | ||
onDidChangeDefault = this.onDidChangeDefaultEmitter.event; | ||
|
||
protected notifyIsDefaultChange(_property: keyof TestRunProfileDTO, isDefault: boolean): void { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suspect this will generate an extra call to the front end:
- Front set "isDefault"
- TestingExt.$onChangeDefault() is called
- notifyDefaultChanged is invoked and sends
$updateTestRunProfile()
I don't think the "observableProperty" mechanism works for this: we need to distinguish where a change is coming from.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I updated to avoid this circular call. Only one call shall be made now.
Hi @tsmaeder, thanks for your comments. I will solve conflicts and rebase to master once the review is done. |
} | ||
|
||
doSetDefault(isDefault: boolean): boolean { | ||
let change = false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not just
if (this._isDefault !== isDefault) {
this._isDefault = isDefault;
this.onDidChangeDefaultEmitter.fire(isDefault);
return true;
}
return false;
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good one! Some remnants of old checkstyles rules :/ That will be fixed.
@rschnekenbu I'm not seeing the test controller after I install the attached extension. Also, does the ""Select default test Profile" se t the |
@tsmaeder, the extension is only activated when you run the command 'Test API: Run all tests'. Do you have any error on the console? There should be an entry in the log that indicates the extension was successful to create the controller ( SUCCESS TestController created: AllTestAPITestController ) |
@rschnekenbu I am having trouble testing this change: could you please give concrete steps how I change the default profile and how I can verify that a default profile is set? Secondly, we really should have a command that sets the default profile from the plugin side: otherwise this code path can't be verified. |
@tsmaeder, here is an updated version of the extension with a timeout function that sets the first profile to default after a small delay (~3sec). This will test the extension side of setting the default value. For the steps:
|
add support to changing default profile in service add event for isDefault onDidChangeProfile add command to change default profile fixes eclipse-theia#13354 Contributed on behalf of STMicroelectronics Signed-off-by: Remi Schnekenburger <rschnekenburger@eclipsesource.com> address review comments reduce code
6775378
to
f1d3e36
Compare
What it does
This pull request add the support of API introduced with VS Code 1.86 on TestRunProfile, the onDidChangeDefault event.
It also adds the capability of changing default profile for a given test controller and a given kind of test run. The isDefault value is now updated as soon as the command "Select Default Test Profiles..." is used in the tool.
Fixes #13354
Contributed on behalf of STMicroelectronics
How to test
Install the following extension, mainly inspired from https://github.com/KevinClapperton/Test-API-functional-test
src:
Test-API-functional-test-0.0.6-src.zip
zip vsix:
test-api-functional-test-0.0.6.zip
This extension will add a test controller and a command to create a test run profile, install a bunch of test and create a test run.
Note: the set
isDefault
value is not kept in settings, so user may need to configure it each time the app is started. This behavior is similar to the one on VS Code.Follow-ups
There are no follow ups known currently.
Review checklist
Reminder for reviewers