aboutsummaryrefslogtreecommitdiffstats
path: root/tests/runner/lib/buildTestUrl.js
blob: 8265488525c0c8e1a2bef338ed9cfb6240855b61 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
export function buildTestUrl( suite, { jquery, migrate, port, reportId } ) {
	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 );
	}

	return `http://localhost:${ port }/tests/unit/${ suite }/${ suite }.html?${ query }`;
}