Skip to content

Commit edbd87b

Browse files
author
adil.rakhaliyev
committed
fix: base url issue test
1 parent 7bbffec commit edbd87b

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

src/api/test-page-url.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,16 @@ export function getUrl (url: string, base?: URL): string {
5151
}
5252

5353
export function prepareBaseUrl (url: string): URL {
54-
url = join(url, '/');
55-
return isAbsolute(url) ? pathToFileURL(url) : new URL(url);
54+
// If it's a web URL (http/https), use it directly
55+
if (/^https?:\/\//i.test(url))
56+
return new URL(url.endsWith('/') ? url : url + '/');
57+
58+
// Handle file URLs explicitly
59+
if (/^file:\/\//i.test(url))
60+
return new URL(url);
61+
62+
// Otherwise, treat it as filesystem path
63+
return pathToFileURL(isAbsolute(url) ? url : join(process.cwd(), url));
5664
}
5765

5866
export function assertPageUrl (url: string, callsiteName: string): void {

0 commit comments

Comments
 (0)