Open Bug 1655422 Opened 2 years ago Updated 5 months ago

List for allowMatchingRejectionsGlobally is never emptied

Categories

(Testing :: Mochitest, task)

Default
task

Tracking

(Not tracked)

People

(Reporter: jdescottes, Unassigned)

References

(Blocks 1 open bug)

Details

The helper allowMatchingRejectionsGlobally allows to ignore promise rejections matching a given regexp:

  allowMatchingRejectionsGlobally(regExp) {
    this._globalRejectionIgnoreFns.push(rejection =>
      regExp.test(rejection.message)
    );
  },

https://searchfox.org/mozilla-central/rev/cf561cece0ca9aeaf0202e68699836d957d0c670/toolkit/modules/tests/modules/PromiseTestUtils.jsm#223

However, _globalRejectionIgnoreFns is never emptied. This means that if any test calls allowMatchingRejectionsGlobally, all the subsequent tests in the suite will be impacted. This means also some tests can fail in isolation, but succeed in a suite (example: Bug 1655411).

I don't know if we should modify the behavior, or just add an API to cleanup the array so that individual tests can cleanup the state on demand.

See Also: → 1655411
You need to log in before you can comment on or make changes to this bug.