2024-04-09 17:31:27 +00:00
|
|
|
export function buildTestUrl( suite, { browserstack, jquery, migrate, port, reportId } ) {
|
2024-03-29 13:13:46 +00:00
|
|
|
if ( !port ) {
|
|
|
|
throw new Error( "No port specified." );
|
|
|
|
}
|
|
|
|
|
|
|
|
const query = new URLSearchParams();
|
|
|
|
|
|
|
|
if ( jquery ) {
|
|
|
|
query.append( "jquery", jquery );
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( migrate ) {
|
|
|
|
query.append( "migrate", "true" );
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( reportId ) {
|
|
|
|
query.append( "reportId", reportId );
|
|
|
|
}
|
|
|
|
|
2024-04-09 17:31:27 +00:00
|
|
|
// BrowserStack supplies a custom domain for local testing,
|
|
|
|
// which is especially necessary for iOS testing.
|
|
|
|
const host = browserstack ? "bs-local.com" : "localhost";
|
|
|
|
return `http://${ host }:${ port }/tests/unit/${ suite }/${ suite }.html?${ query }`;
|
2024-03-29 13:13:46 +00:00
|
|
|
}
|