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:
@@ -37,6 +37,11 @@ export default class CommandLine {
|
||||
// Convert the string log level back to LoggingLevel enum
|
||||
const logLevel = rawOptions.logLevel ? LoggingLevelMapping.convertLoggingLevelTypeToLoggingLevel(rawOptions.logLevel) : defaultLogLevel;
|
||||
|
||||
// Validate required options are present
|
||||
if (!rawOptions.applicationId || !rawOptions.secret || !rawOptions.pcastUri || !rawOptions.channelUri) {
|
||||
throw new Error('Missing required command line options: applicationId, secret, pcastUri, and channelUri are required');
|
||||
}
|
||||
|
||||
return {
|
||||
...rawOptions,
|
||||
logLevel
|
||||
|
||||
Reference in New Issue
Block a user