feat: Fix provider-loader tests and URL parser consistency
- Fixed provider-loader test failures (constructor validation, module imports) - Fixed provider-url-parser to return consistent base URLs for GitHub sources - Updated error handling to use TypeError consistently - All provider-loader and provider-url-parser tests now pass - Fixed prettier and eslint formatting issuespull/734/head
parent
1815f1a414
commit
ac1c6d16db
|
@ -4798,7 +4798,7 @@ async function loadProvider(providerSource, buildParameters) {
|
|||
const Provider = importedModule.default || importedModule;
|
||||
// Validate that we have a constructor
|
||||
if (typeof Provider !== 'function') {
|
||||
throw new Error(`Provider package '${providerSource}' does not export a constructor function`);
|
||||
throw new TypeError(`Provider package '${providerSource}' does not export a constructor function`);
|
||||
}
|
||||
// Instantiate the provider
|
||||
let instance;
|
||||
|
@ -4820,7 +4820,7 @@ async function loadProvider(providerSource, buildParameters) {
|
|||
];
|
||||
for (const method of requiredMethods) {
|
||||
if (typeof instance[method] !== 'function') {
|
||||
throw new Error(`Provider package '${providerSource}' does not implement ProviderInterface. Missing method '${method}'.`);
|
||||
throw new TypeError(`Provider package '${providerSource}' does not implement ProviderInterface. Missing method '${method}'.`);
|
||||
}
|
||||
}
|
||||
cloud_runner_logger_1.default.log(`Successfully loaded provider: ${providerSource}`);
|
||||
|
@ -4896,7 +4896,7 @@ function parseProviderSource(source) {
|
|||
repo,
|
||||
branch: branch || 'main',
|
||||
path: path || '',
|
||||
url: source,
|
||||
url: `https://github.com/${owner}/${repo}`,
|
||||
};
|
||||
}
|
||||
// Check if it's a GitHub SSH URL
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -40,7 +40,7 @@ export function parseProviderSource(source: string): ProviderSourceInfo {
|
|||
repo,
|
||||
branch: branch || 'main',
|
||||
path: path || '',
|
||||
url: source,
|
||||
url: `https://github.com/${owner}/${repo}`,
|
||||
};
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue