Open Bug 1655422 Opened 4 years ago Updated 2 years 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

CC'ing Joel in case it's something we want to see fixed. It will also affect some Remote Agent mochitests soon, and a workaround would be to put these specific files into their own manifest file.

You need to log in before you can comment on or make changes to this bug.