Advanced preload modules have several hooks that are covered in this section.
The argument to this hook is the Test2::Harness::Job object, from which
you can get things like the filename, directives, etc.
Note that this occurs BEFORE some state cleanup such as fixing $0 and rewinding DATA handles is done.
The argument to this hook is the Test2::Harness::Job object, from which
you can get things like the filename, directives, etc.
The very next thing after this hook returns is the use of goto::file to jump into the test file.
This is very useful if you have a very long list of modules to preload.
The first argument is a hashref of blacklisted modules you should skip (if possible). This list is built based on inotify changes that have been observed in previous iterations.
The second argument is the number of jobs that will be run. This is useful if you want to avoid preloading eveything when only a single test file will be run.
Preload stages are different groups of preloads, often built on top of previous stages.
As an example, at ZipRecruiter we have stages like this:
Note that this all works for persist mode as well, each stage will have its own process all set to go!
For backcompat none of these hooks should change very much.
Moving forward there may be a new system that lets you define your preloads as a data structure (DSL?) that allows smarter inheritence, and requires less work from you.