Write current URL to console in TestCafe
You've missed the await
keyword before calling ClientFunction. Please refer to http://devexpress.github.io/testcafe/documentation/test-api/obtaining-data-from-the-client.html#executing-client-functions.
I suggest you write it in the following manner:
const url = await getURL();
console.log(url);
const getURL = await ClientFunction(() => window.location.href)();
console.log(getURL) //will work
Just make getURL() self invocation function. IMHO