mirror of
https://github.com/discourse/discourse.git
synced 2025-01-18 21:02:48 +08:00
DEV: Fix settledState debug message (#24544)
A properly formatted string instead of circular-JSON error
This commit is contained in:
parent
2befff5101
commit
1f2a25331b
|
@ -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-console
|
||||
console.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})`
|
||||
);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user