Enhance CommandLine and TestConfiguration for improved option validation and logging
* Added validation for required command line options in the `CommandLine` class to ensure necessary parameters are provided. * Updated `TestConfiguration` to store and expose the logging level from command line options. * Refactored `BrowserstackApi` to improve method naming and added content type headers for API requests. * Changed `SupportedBrowser` type to be exported for better accessibility. * Updated `Page` and `SubscribingPage` classes to use a consistent browser import and improved constructor parameters.
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import type {CommandLineOptions} from './CommandLine';
|
||||
import {LoggingLevel} from '../logger/LoggingLevel';
|
||||
|
||||
type ApplicationCredentials = {
|
||||
applicationId: string;
|
||||
@@ -26,6 +27,7 @@ export default class TestConfiguration {
|
||||
private readonly _publishers: string[];
|
||||
private readonly _tests: string[];
|
||||
private readonly _browserstack: BrowserstackConfiguration;
|
||||
private readonly _logLevel: LoggingLevel;
|
||||
|
||||
constructor(commandLineOptions: CommandLineOptions) {
|
||||
this._applicationCredentials = {
|
||||
@@ -43,6 +45,7 @@ export default class TestConfiguration {
|
||||
this._viewers = commandLineOptions.viewers;
|
||||
this._publishers = commandLineOptions.publishers;
|
||||
this._tests = commandLineOptions.tests;
|
||||
this._logLevel = commandLineOptions.logLevel;
|
||||
this._browserstack = {
|
||||
enabled: commandLineOptions.useBrowserstack,
|
||||
local: commandLineOptions.useBrowserstackLocal,
|
||||
@@ -74,4 +77,8 @@ export default class TestConfiguration {
|
||||
get browserstack(): BrowserstackConfiguration {
|
||||
return this._browserstack;
|
||||
}
|
||||
}
|
||||
|
||||
get logLevel(): LoggingLevel {
|
||||
return this._logLevel;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user