setTimeout inside a wait function that is exposed to a node process.
updated test 3 work with new wait function