Introduce forceUpdateConfiguration method
This commit is contained in:
@@ -119,6 +119,14 @@ export interface DistributionConfig {
|
||||
ownerName?: string;
|
||||
repositoryName?: string;
|
||||
onDidChangeConfiguration?: Event<void>;
|
||||
|
||||
/**
|
||||
* This forces an update of the distribution, even if the settings haven't changed.
|
||||
*
|
||||
* This should only be used when the distribution has been updated outside of the extension
|
||||
* and only in tests. It should not be called in production code.
|
||||
*/
|
||||
forceUpdateConfiguration(): void;
|
||||
}
|
||||
|
||||
// Query server configuration
|
||||
@@ -275,6 +283,10 @@ export class DistributionConfigListener
|
||||
);
|
||||
}
|
||||
|
||||
public forceUpdateConfiguration() {
|
||||
this._onDidChangeConfiguration.fire(undefined);
|
||||
}
|
||||
|
||||
protected handleDidChangeConfiguration(e: ConfigurationChangeEvent): void {
|
||||
this.handleDidChangeConfigurationForRelevantSettings(
|
||||
DISTRIBUTION_CHANGE_SETTINGS,
|
||||
|
||||
@@ -39,15 +39,11 @@ beforeAll(async () => {
|
||||
const cliVersion = await extension.cliServer.getVersion();
|
||||
|
||||
if (cliVersion.compare(process.env.CLI_VERSION) !== 0) {
|
||||
// This calls the private `updateConfiguration` method in the `ConfigListener`
|
||||
// It seems like the CUSTOM_CODEQL_PATH_SETTING.updateValue() call in
|
||||
// `beforeAllAction` doesn't fire the event that the config has changed.
|
||||
// `forceUpdateConfiguration` will fire the event manually.
|
||||
// This is a hacky workaround.
|
||||
(
|
||||
extension.distributionManager.config as unknown as {
|
||||
updateConfiguration: () => void;
|
||||
}
|
||||
).updateConfiguration();
|
||||
extension.distributionManager.config.forceUpdateConfiguration();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user