Closed Bug 1596114 Opened 2 years ago Closed 2 years ago

Migrate server unit tests to async/await

Categories

(DevTools :: Debugger, enhancement, P3)

enhancement

Tracking

(firefox73 fixed)

RESOLVED FIXED
Firefox 73
Tracking Status
firefox73 --- fixed

People

(Reporter: bhackett1024, Assigned: chujunlu)

Details

Attachments

(7 files)

A lot of server unit tests use somewhat complicated promise based logic for performing their actions. Migrating them to async/await would make them easier to read and maintain.

Thanks for the report Brian!

What specific tests do you have in mind?
Should this be a meta?

Honza

Priority: -- → P3

These are the tests in devtools/server/tests/unit. This issue came up in bug 1512152 in regard to thread front based tests in that directory, though the issue is more general than those tests specifically.

This'd be so awesome.

I'd like to take a stab at it.

My understanding of the task is to refactor the tests that use new Promise or use threadFrontTestFinished. Is that correct? May I submit a patch with some tests that I refactored to make sure I'm on the right track? Thanks! I might break this into more than one patches.

I refactored some of the unit tests to see if I'm on the right direction. If so, I'll continue with other unit tests.

Assignee: nobody → chujunlu
Status: NEW → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 73

The 3 test_objectgrips-fn-apply tests and 3 test_objectgrips-property-value tests used somewhat complicated callbacks returning promise . I thought they were not easy to read, and I might fail to understand its subtleness. I wondered why the tests were written in that way?

Attachment #9116926 - Attachment description: Refactor server unit tests to async/await part2 r=jlast → Bug 1596114 - Refactor server unit tests to async/await part2 r=jlast

Remove threadFrontTestFinished

Remove threadFrontTestFinished

Pushed by jlaster@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/49ecd149cade
Refactor server unit tests part4 r=bhackett,jlast
Pushed by jlaster@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/f25ba905dedd
Refactor server unit tests part3 r=jlast,bhackett
Pushed by jlaster@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/c5a5a341613b
Refactor server unit tests to async/await part2 r=jlast

test_breakpoint-25.js is wip.

Pushed by jlaster@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/826012956299
Refactor server unit tests part5 r=bhackett,jlast

Remove threadFrontTestFinished

This should be the last patch for refactoring server xpcshell test. Thanks for the code reviews all the way. I would suggest reviewing and merging part6 first, since part7 removes waitForFinish, an option that part6 test files currently use.

Pushed by jlaster@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/1ad8134a2621
Refactor server unit tests part6 r=jlast
You need to log in before you can comment on or make changes to this bug.