Closed Bug 1573408 Opened 5 years ago Closed 5 years ago

Restore mock of console.error in Jests tests

Categories

(DevTools :: Application Panel, defect, P1)

defect

Tracking

(firefox70 fixed)

RESOLVED FIXED
Firefox 70
Tracking Status
firefox70 --- fixed

People

(Reporter: ladybenko, Assigned: ladybenko)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

From this review comment on the patch for 1565172:

[...] We aren't restoring the mock after the tests are done. And since we are mocking console.error, that means that later on if we have a test that is failing, we might not get proper error logging. [...]

This restoration can be done manually, but i'd suggest using mockRestore in conjuction with spyOn, as explained here https://jestjs.io/docs/en/mock-function-api.html#mockfnmockrestore . We would need to ensure this restoration is done after all tests in this suite have been run.

Summary: Restore mock of console.error → Restore mock of console.error in Jests tests
Assignee: nobody → balbeza
Status: NEW → ASSIGNED
Priority: P2 → P1
Pushed by balbeza@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/9cf024260752
Restore mock in jest tests r=Ola,sole
Status: ASSIGNED → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 70
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: