test: fix race condition in test-worker-process-cwd.js
This simplifies the test logic and fixes the race condition that could happen right now.
Refs: #28193 (closed) Closes: #28477 Fixes: #27669 (closed)
Checklist
-
make -j4 test
(UNIX), orvcbuild test
(Windows) passes -
tests and/or benchmarks are included -
documentation is changed or added -
commit message follows commit guidelines