Closed Bug 1544051 Opened 2 years ago Closed 2 years ago

Automatically load AddTask.js in mochitest-chrome and mochitest-plain through SimpleTest.js

Categories

(Testing :: Mochitest, task)

Version 3
task
Not set
normal

Tracking

(firefox68 fixed)

RESOLVED FIXED
mozilla68
Tracking Status
firefox68 --- fixed

People

(Reporter: bgrins, Assigned: bgrins)

References

Details

Attachments

(5 files)

Right now to use add_task you have to explicitly include this file (https://searchfox.org/mozilla-central/source/testing/mochitest/tests/SimpleTest/AddTask.js) with:

  • mochitest-chrome: <script src="chrome://mochikit/content/tests/SimpleTest/AddTask.js"></script>
  • mochitest-plain: <script src="/tests/SimpleTest/AddTask.js"></script>

I think we should be including this anywhere that loads SimpleTest.js because:

  1. add_task is a nicer way to work with tests (it automatically calls SimpleTest.waitForExplicitFinish, waits for load, is async by default)
  2. the script doesn't have any side effects unless called
  3. 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.

Attached file find-remove-addtask.sh

Script for removing <script> tags referencing AddTask.js

Haven't heard any feedback in https://groups.google.com/d/msg/mozilla.dev.platform/PqL0OC2C-90/15_zAj7_CgAJ, so I'm going to push up some patches to make this change.

(In reply to Brian Grinstead [:bgrins] from comment #2)

Haven't heard any feedback in https://groups.google.com/d/msg/mozilla.dev.platform/PqL0OC2C-90/15_zAj7_CgAJ, so I'm going to push up some patches to make this change.

Joel, are you a good reviewer for this change, or could you recommend someone if not? I see you initially reviewed SpawnTask.js before it was renamed to AddTask.js: https://hg.mozilla.org/mozilla-central/log/22acceec0478/testing/mochitest/tests/SimpleTest/SpawnTask.js.

Flags: needinfo?(jmaher)

:ahal would be a good reviewer for this

Flags: needinfo?(jmaher)
Assignee: nobody → bgrinstead
Status: NEW → ASSIGNED
Pushed by bgrinstead@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/77269915d66a
Part 1 - Move add_task into SimpleTest.js r=ahal
https://hg.mozilla.org/integration/autoland/rev/480e15689b61
Part 2 - Remove some references to AddTask.js that aren't caught by the script in part 3 r=ahal
https://hg.mozilla.org/integration/autoland/rev/c83490ca7185
Part 3 - Scripted change to remove references to AddTask.js r=ahal
https://hg.mozilla.org/integration/autoland/rev/dfe0b0d0827e
Part 4 - Remove AddTask.js r=ahal
You need to log in before you can comment on or make changes to this bug.