// initialize the worker manager by passing in the `wallaby` parameter, and the reference to your worker class.

workerManager.Setup(wallaby, worker.Worker);

},

Notes

The onInit function will run the first time Wallaby spawns a worker then it will run the onEach function. From then on, only the onEach function will run in response to code changes.

Keep in mind, that onEach runs before a group of tests runs, not before each individual test. You still need to take care of resetting your data using the
beforeEach method of your testing framework of choice.

For example, lets say you make a code change and Wallaby decides it needs to re-run three tests based on that change. The onEach method will run once and then the three tests will run.

Within the onInit and onEach functions you can access the wallaby variable from the setup function with this.wallaby.

This is helpful for altering your configuration on a worker by worker basis. For example, you could use this.wallaby.workerId in order to have each worker spawn a docker postgres database attached to different ports.

From within your application code you can use the global variable global['_wallabyWorker'] to access the instance of the worker class created for this worker.