aboutsummaryrefslogtreecommitdiffstats
path: root/tests/runner/lib/buildTestUrl.js
diff options
context:
space:
mode:
Diffstat (limited to 'tests/runner/lib/buildTestUrl.js')
-rw-r--r--tests/runner/lib/buildTestUrl.js21
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/runner/lib/buildTestUrl.js b/tests/runner/lib/buildTestUrl.js
new file mode 100644
index 000000000..826548852
--- /dev/null
+++ b/tests/runner/lib/buildTestUrl.js
@@ -0,0 +1,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 }`;
+}