Closed Bug 956385 Opened 10 years ago Closed 10 years ago

SimpleTest.monitorConsole counts non-matching messages towards the total

Categories

(Testing :: Mochitest, defect)

x86
macOS
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED
mozilla29

People

(Reporter: bholley, Assigned: bholley)

References

Details

Attachments

(1 file)

SimpleTest.monitorConsole is a nice mechanism that allows consumers to check for an expected series of console messages. It optionally allows consumers to force a test failure of a console message is received, but this is understandably not the default, since it increases the chance of breakage when unrelated console warning are added (i.e. for deprecated web features).

In the default case, unexpected console messages are just ignored (that is to say: failures of the regexp do not cause the test to fail). However, they _still_ increment the counter of expected messages, which is totally wrong. In the current world, a test which does not get the message it expects, but gets a totally unrelated message (say, a syntax error), will pass, when it should definitely fail.

I have a patch for this. Pushing to try momentarily.
Drew did a rewrite of this in bug 898593. We discussed it a little bit there, but we probably just missed this corner case. Thanks for filing the bug (and hacking on it).
Blocks: 898593
This looks green. Flagging ted for review.
Attachment #8355674 - Flags: review?(ted)
Attachment #8355674 - Flags: review?(ted) → review+
https://hg.mozilla.org/mozilla-central/rev/524b810fa489
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla29
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: