Fix test/replication.html, broken in commit:aa0849b.
Move the test utility functions to a shared utility module.
Switch `/* ( p1, p2 ) */` callback comment notation to `/* p1, p2 */`.
Watch for new async actions started during an async action and resolve.

Async operations need to complete in a consistent manner in order for
the replication computation to work correctly across multiple clients.

If a queue action starts one more more async operations, the operations
need to complete before the next queue item is started. And they need to
complete in the same order they were started.

If an async action starts other async actions, the outer action
shouldn't complete until the inner actions have completed.

For example, if a node's `initiailze` calls `node.children.create`, wait
for the child node to finish initializing before allowing the parent
node to complete.

Fixes #2137.