DEV: use REPORT_REQUESTS=1 to find all requests

We can use this to profile our pretender and ensure nothing is superfluous
and nothing is missing
This commit is contained in:
Sam Saffron
2020-04-02 16:01:38 +11:00
parent 37bf38f801
commit 8a50ab45aa
3 changed files with 23 additions and 2 deletions

View File

@ -117,7 +117,17 @@ QUnit.testStart(function(ctx) {
return body;
};
if (QUnit.config.logAllRequests) {
server.handledRequest = function(verb, path, request) {
console.log("REQ: " + verb + " " + path);
};
}
server.unhandledRequest = function(verb, path) {
if (QUnit.config.logAllRequests) {
console.log("REQ: " + verb + " " + path + " missing");
}
const error =
"Unhandled request in test environment: " + path + " (" + verb + ")";
window.console.error(error);