Closed Bug 1013816 Opened 10 years ago Closed 10 years ago

Declare more properties as leaking on the global in Gaia unit tests

Categories

(Firefox OS Graveyard :: Gaia, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED DUPLICATE of bug 1014180

People

(Reporter: peterv, Assigned: peterv)

References

Details

Attachments

(1 file)

A number of Gaia unit tests use Sinon.JS to stub properties on |window|. Sinon.JS adds those stubs as own properties on |window|, even though some of them might live on an object in the prototype chain. We also use Mocha to detect leaking properties on the global by comparing the list of properties at various points during the tests. As we're switching Window to WebIDL the properties from EventTarget.prototype (addEventListener/removeEventListener/dispatchEvent) will not be own properties of |window|, and so Mocha will see them show up on the global as soon as we stub them using Sinon.JS. I've fixed the tests that are affected by adding these properties to the list of properties to ignore with mocha.globals(...).
Blocks: 789261
Comment on attachment 8426087 [details]
Link to Github pull-request: https://github.com/mozilla-b2g/gaia/pull/19466

Let's ask the review to people that knows the test framework much better than me :)
Attachment #8426087 - Flags: review?(21) → review?(felash)
Comment on attachment 8426087 [details]
Link to Github pull-request: https://github.com/mozilla-b2g/gaia/pull/19466

Vivien, is it good enough for you if I feedback+ ? :)

I don't know much of these tests (except notifications_test), would it make sense to ask someone else (for example etienne)?

I tried to find another way of doing this but I couldn't. Maybe sinon should clean up in a better way; I'll dig in their code to see what they're really doing, but for now it looks good enough.
Attachment #8426087 - Flags: review?(felash)
Attachment #8426087 - Flags: review?(21)
Attachment #8426087 - Flags: feedback+
Actually, we're removing the global leak check in master in bug 1014180
Status: ASSIGNED → RESOLVED
Closed: 10 years ago
Resolution: --- → DUPLICATE
Comment on attachment 8426087 [details]
Link to Github pull-request: https://github.com/mozilla-b2g/gaia/pull/19466

Seems like my review is not needed anymore!
Attachment #8426087 - Flags: review?(21)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: