A platform for community discussion. Free, open, simple.
DEV: Fix settledState debug message (#24544)
Jarek Radosz1f2a25331b4f
diff --git a/app/assets/javascripts/discourse/tests/setup-tests.js b/app/assets/javascripts/discourse/tests/setup-tests.jsindex 8fb5c25fb11..037d0e3f88b 100644--- a/app/assets/javascripts/discourse/tests/setup-tests.js+++ b/app/assets/javascripts/discourse/tests/setup-tests.js@@ -419,10 +419,19 @@ function patchFailedAssertion() {QUnit.assert.pushResult = function (resultInfo) {if (!resultInfo.result && !isSettled()) {+ const settledState = getSettledState();+ let stateString = Object.entries(settledState)+ .filter(([, value]) => value === true)+ .map(([key]) => key)+ .join(", ");++ if (settledState.pendingRequestCount > 0) {+ stateString += `, pending requests: ${settledState.pendingRequestCount}`;+ }+// eslint-disable-next-line no-consoleconsole.warn(- "ℹ️ Hint: when the assertion failed, the Ember runloop was not in a settled state. Maybe you missed an `await` further up the test? Or maybe you need to manually add `await settled()` before your assertion?",- JSON.stringify(getSettledState())+ `ℹ️ Hint: when the assertion failed, the Ember runloop was not in a settled state. Maybe you missed an \`await\` further up the test? Or maybe you need to manually add \`await settled()\` before your assertion? (${stateString})`);}