we need to upstream this code properly to the js-test-agent repo. This cannot land as is.