wallaby.js injects your code with globals to check for code covarage etc.
Those can look like $_$wp, $_$wpe, $_$w, $_$wf, $_$wv, $_$tracer
.
Usually this is invisible to the user.
But, when using the page.evaluate()
function (or similar functions) you are passing pageFunction
(Function to be evaluated in the page context) to the page in the headless browser.
In the browser the globals that wallaby.js just injected to the code simply do not exist, hence the exit code: $_$wf
is not defined.
You can still use wallaby.js to run your other tests but for the tests that use evaluate you will have to use your normal "npm test" (or what you would use in the terminal to run the tests), outside wallaby the code will be clean of those globals and they should not fail.