mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
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:
@@ -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);
|
||||
|
||||
@@ -112,6 +112,13 @@ async function runAllTests() {
|
||||
await Runtime.evaluate({
|
||||
expression: `(${qunit_script})()`
|
||||
});
|
||||
|
||||
if (args[0].indexOf("report_requests=1") > -1) {
|
||||
await Runtime.evaluate({
|
||||
expression: "QUnit.config.logAllRequests = true"
|
||||
});
|
||||
}
|
||||
|
||||
const timeout = parseInt(args[1] || 300000, 10);
|
||||
var start = Date.now();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user