This has now landed, so feel free to start using add_task without any extra
boilerplate in mochitests.

AddTask.js is also now removed so if you had any in-flight patches that
were adding tests using it please remove the <script> tag referencing it.

Thanks,
Brian

On Fri, Apr 12, 2019 at 10:00 AM Brian Grinstead <bgrinst...@mozilla.com>
wrote:

> This came up in
> https://groups.google.com/d/msg/mozilla.dev.platform/eptWENSn4wM/sjCWfj1LBwAJ
> :
>
> > On Apr 1, 2019, at 12:38 PM, Brian Grinstead <bgrinst...@mozilla.com>
> wrote:
> >> On Apr 1, 2019, at 12:15 PM, Boris Zbarsky <bzbar...@mit.edu> wrote:
> >> I do have one other question on the templates: for mochitest-plain,
> add_task is a pretty rare thing to do, so I'm not sure defaulting the
> template to that makes sense.  For mochitest-chrome I'm not really sure;
> for mochitest-browse I agree that defaulting to add_task makes sense.
> >>
> >> For the cases where we don't default to add_task (if any) we probably
> shouldn't include AddTask.js either, like we don't include other things
> that are helpful in only some test files (EventUtils.js, etc).
> >
> > add_task does seem relatively rare on chrome right now, but I don’t
> think it should be. It cleans up the boilerplate (no need to call
> SimpleTest.waitForExplicitFinish and SimpleTest.finish, no need to figure
> out how to hook up [onload], and gives async tests right off the bat). I’m
> not as familiar with plain test, but I’d be fine to drop that from the
> template if it’s not as useful.
> >
> > I also think we should import the AddTask.js contents into SimpleTest.js
> to make it available without an extra script, but that’s another
> discussion/bug :).
>
> I filed https://bugzilla.mozilla.org/show_bug.cgi?id=1544051 to make this
> change. I think we should be including add_task anywhere that loads
> SimpleTest.js because:
>
>         • add_task is a nicer way to work with tests (it automatically
> calls SimpleTest.waitForExplicitFinish, waits for load, is async by default)
>         • the script doesn't have any side effects unless called
>         • it's available by default in other suites (mochitest-browser,
> xpcshell)
>
> My proposal is to move the contents of AddTask.js into SimpleTest.js and
> then remove the separate file and any references to it. Would like to hear
> if there are reasons not to do this, otherwise I’ll make a patch to do so.
>
> Brian
>
>
_______________________________________________
dev-platform mailing list
dev-platform@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-platform

Reply via email to