Closed Bug 1596114 Opened 2 years ago Closed 2 years ago

Migrate server unit tests to async/await


(DevTools :: Debugger, enhancement, P3)



(firefox73 fixed)

Firefox 73
Tracking Status
firefox73 --- fixed


(Reporter: bhackett1024, Assigned: chujunlu)



(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?


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
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
Refactor server unit tests part4 r=bhackett,jlast
Pushed by
Refactor server unit tests part3 r=jlast,bhackett
Pushed by
Refactor server unit tests to async/await part2 r=jlast

test_breakpoint-25.js is wip.

Pushed by
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
Refactor server unit tests part6 r=jlast
You need to log in before you can comment on or make changes to this bug.