website/docs/flowcharts/CreateLocalWorkerProcess.md
This flowchart explains how a worker process is created.
graph TD
STARTINSTANCE("@wdio/cli:launcher startInstance()")-->
CALLRUNNERRUNMETHOD["Call @wdio/local-runner:index.js run()
return @wdio/local-runner:worker instance"]-->
ADDLISTENERS["Add message, error, exit event
listeners to worker instance."]-->
CALLPOSTMESSAGE["Call @wdio/local-runner:worker postMessage().
If an instance is not created, call startProcess()
and fork a child process."]-->
FORKCHILDPROCESS["@wdio/local-runner:worker startProcess() forks a
child process using the child_process fork() method."]-->
CREATERUNNERINSTANCE["The args passed to child_process fork execute the code in the
@wdio/local-runner run.js.This action creates a new instance
of @wdio/runner index.js. "]-->
ADDHANDLERS["Add message, error and exit listeners to the forked process.
These listeners will process commands."]-->
RUNWDIORUNNERINDEXJS["@wdio/local-runner postMessage() instructs the child process to
run the code @wdio/runner index.js."]-->
POSTMESSAGE["@wdio/local-runner postMessage() sends child process a message that
contains the capability id,'run' command, config file, CLI args,
capabilties, config details about automation backend, number of retries.
When the child process receives this message, all services, reports and
services are setup. The tests are them executed."]-->
CONTROLPASSEDTORUNNERINDEXJS["Control passed to @wdio/runner:index"]-->
TESTINITCOMPLETE("All services, reports and services are setup. The tests are them executed.
See Test Execution flow chart for more information.")