From 5a8f7cf54e4ee37e0831389313daaa1e885ccf5d Mon Sep 17 00:00:00 2001 From: Richard Hansen Date: Wed, 25 Nov 2020 13:18:11 -0500 Subject: [PATCH] test runner: Simplify `getURLParameter()` --- tests/frontend/runner.js | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/tests/frontend/runner.js b/tests/frontend/runner.js index 982156902..616c065b3 100644 --- a/tests/frontend/runner.js +++ b/tests/frontend/runner.js @@ -154,12 +154,7 @@ $(() => { }); }; - // http://stackoverflow.com/questions/1403888/get-url-parameter-with-jquery - const getURLParameter = function (name) { - return decodeURI( - (RegExp(`${name}=(.+?)(&|$)`).exec(location.search) || [null, null])[1] - ); - }; + const getURLParameter = (name) => (new URLSearchParams(location.search)).get(name); // get the list of specs and filter it if requested const specs = specs_list.slice(); @@ -179,7 +174,7 @@ $(() => { helper.init(() => { // configure and start the test framework const grep = getURLParameter('grep'); - if (grep !== 'null') { + if (grep != null) { mocha.grep(grep); }