bugzilla.mozilla.org will be intermittently unavailable on Saturday, March 24th, from 16:00 until 20:00 UTC.
In Bug 874510 we want to upgrade mocha to a newer version. Camera tests are failing with the newer mocha: 02:43:12 INFO - TEST-UNEXPECTED-FAIL | camera/test/unit/lib/camera/camera_test.js | lib/camera/camera Camera#configure() "before each" hook: wrapper - this.mozCamera is null 02:43:12 INFO - TypeError: this.mozCamera is null 02:43:12 INFO - at (anonymous) (app://camera.gaiamobile.org/test/unit/lib/camera/camera_test.js:824:7) 02:43:12 INFO - at wrapper (app://camera.gaiamobile.org/common/test/mocha_generators.js:62:19) 02:43:12 INFO - at run (app://camera.gaiamobile.org/common/vendor/mocha/mocha.js:4311:7) 02:43:12 INFO - at next (app://camera.gaiamobile.org/common/vendor/mocha/mocha.js:4613:5) 02:43:12 INFO - at (anonymous) (app://camera.gaiamobile.org/common/vendor/mocha/mocha.js:4630:5) 02:43:12 INFO - at timeslice (app://camera.gaiamobile.org/common/vendor/mocha/mocha.js:5763:5) 0 https://tbpl.mozilla.org/php/getParsedLog.php?id=48759080&tree=Gaia-Try#error2 The issue is that with the new mocha "this" is no more shared between all tests/suites. I don't remember the exact rules, but I think a new context is created when creating a nested suite, with the outer context as prototype. Something like: "var nestedContext = Object.create(outerContext)". So when in the test this is executed: "this.mozCamera = null", it's not reset in the setup. I fix this simply by running "delete this.mozCamera" instead. This is not the same semantic but this seems to do the trick :)
Created attachment 8495444 [details] [review] github PR
Attachment #8495444 - Flags: review?(wilsonpage)
Attachment #8495444 - Flags: review?(wilsonpage) → review+
master: e9868fe4483f760f8d4ba0b53c31f176f9e084c8 thanks !
Status: NEW → RESOLVED
Last Resolved: 4 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.