Enhance CommandLine and LoggerFactory for better type safety and clarity

* Further refined `CommandLine` class to ensure consistent use of `CommandLineOptions`.
* Improved method organization in command line option setup for better readability.
* Updated `LoggerFactory` to utilize `LoggingLevel` directly in logging level management, streamlining the process.
This commit is contained in:
2025-08-18 18:32:11 -04:00
parent eced0a6a2c
commit a698b85c51
2 changed files with 13 additions and 61 deletions

View File

@@ -1,5 +1,7 @@
import SupportedBrowser from "./SupportedBrowser";
// Source: https://github.com/browserstack/api
export class BrowserstackApi {
private readonly _baseUrl: string = 'https://api.browserstack.com/5';
private readonly _authorizationHeader: string;
@@ -9,11 +11,16 @@ export class BrowserstackApi {
}
public async getSupportedBrowsers(): Promise<SupportedBrowser[]> {
const response = await fetch(`${this._baseUrl}/browsers?flat=true`, {
headers: {
'Authorization': this._authorizationHeader
}
});
const endpoint = `${this._baseUrl}/browsers?flat=true`;
const headers = {
'Authorization': this._authorizationHeader
};
const response = await fetch(endpoint, { headers });
if (!response.ok) {
throw new Error(`Failed to fetch BrowserStack supported browsers due to [ ${response.statusText}]`);
}
return response.json() as Promise<SupportedBrowser[]>;
}