Fix `waitUntilIDEMessage` in `./tool test`
Fix `waitUntilIDEMessage` in `./tool test`

Summary:
`waitUntilIDEMessage` would check the most recent message whenever the `'message'` event was emitted. This was racy when multiple messages showed up at the same time.

The new logic keeps track of which index needs to be checked next.

Reviewed By: mroch

Differential Revision: D15723063

fbshipit-source-id: ff1021e64ad42c4d3a43bbf6ce7d0d1ae00d7f16

nmote/flow,nmote/flow,nmote/flow,nmote/flow,nmote/flow,nmote/flow,nmote/flow