Debian Codegraph @

lib/App/Yath/Command/abort.pm

raw
1 package App::Yath::Command::abort;
2 use strict;
3 use warnings;
4
5 our $VERSION = '1.000179';
6
7 use Time::HiRes qw/sleep/;
8 use Term::Table;
9
10 use File::Spec();
11
12 use App::Yath::Util qw/find_pfile/;
13
14 use Test2::Harness::Runner::State;
15 use Test2::Harness::Util::File::JSON();
16 use Test2::Harness::Util::Queue();
17
18 use Test2::Harness::Util qw/open_file/;
19
20 use parent 'App::Yath::Command::status';
21 use Test2::Harness::Util::HashBase;
22
23 sub group { 'persist' }
24
25 sub summary { "Abort all currently running or queued tests without killing the runner" }
26 sub cli_args { "" }
27
28 sub description {
29 return <<" EOT";
30 This command will kill all running tests and clear the queue, but will not close the runner.
31 EOT
32 }
33
34 sub pfile_params { (no_fatal => 1) }
35
36 sub run {
37 my $self = shift;
38
39 # Get the output from finding the pfile
40 $self->pfile_data();
41
42 my $state = Test2::Harness::Runner::State->new(
43 workdir => $self->workdir,
44 observe => 1,
45 );
46
47 $state->poll;
48 print "\nTruncating Queue...\n\n";
49 $state->truncate;
50 $state->poll;
51
52 my $running = $state->running_tasks;
53 for my $task (values %$running) {
54 my $pid = $self->get_job_pid($task->{run_id}, $task->{job_id}) // next;
55 my $file = $task->{rel_file};
56 print "Killing test $pid - $file...\n";
57 kill('INT', $pid);
58 }
59
60 print "\n";
61 return 0;
62 }
63
64 1;
65
66 __END__
67
68 =pod
69
70 =encoding UTF-8
71
72 =head1 NAME
73
74 App::Yath::Command::abort - Abort all currently running or queued tests without killing the runner
75
76 =head1 DESCRIPTION
77
78 This command will kill all running tests and clear the queue, but will not close the runner.
79
80
81 =head1 USAGE
82
83 $ yath [YATH OPTIONS] abort [COMMAND OPTIONS]
84
85 =head2 YATH OPTIONS
86
87 =head3 Developer
88
89 =over 4
90
91 =item --dev-lib
92
93 =item --dev-lib=lib
94
95 =item -D
96
97 =item -D=lib
98
99 =item -Dlib
100
101 =item --no-dev-lib
102
103 Add paths to @INC before loading ANYTHING. This is what you use if you are developing yath or yath plugins to make sure the yath script finds the local code instead of the installed versions of the same code. You can provide an argument (-Dfoo) to provide a custom path, or you can just use -D without and arg to add lib, blib/lib and blib/arch.
104
105 Can be specified multiple times
106
107
108 =back
109
110 =head3 Environment
111
112 =over 4
113
114 =item --persist-dir ARG
115
116 =item --persist-dir=ARG
117
118 =item --no-persist-dir
119
120 Where to find persistence files.
121
122
123 =item --persist-file ARG
124
125 =item --persist-file=ARG
126
127 =item --pfile ARG
128
129 =item --pfile=ARG
130
131 =item --no-persist-file
132
133 Where to find the persistence file. The default is /{system-tempdir}/project-yath-persist.json. If no project is specified then it will fall back to the current directory. If the current directory is not writable it will default to /tmp/yath-persist.json which limits you to one persistent runner on your system.
134
135
136 =item --project ARG
137
138 =item --project=ARG
139
140 =item --project-name ARG
141
142 =item --project-name=ARG
143
144 =item --no-project
145
146 This lets you provide a label for your current project/codebase. This is best used in a .yath.rc file. This is necessary for a persistent runner.
147
148
149 =back
150
151 =head3 Finder Options
152
153 =over 4
154
155 =item --finder MyFinder
156
157 =item --finder +Test2::Harness::Finder::MyFinder
158
159 =item --no-finder
160
161 Specify what Finder subclass to use when searching for files/processing the file list. Use the "+" prefix to specify a fully qualified namespace, otherwise Test2::Harness::Finder::XXX namespace is assumed.
162
163
164 =back
165
166 =head3 Help and Debugging
167
168 =over 4
169
170 =item --show-opts
171
172 =item --no-show-opts
173
174 Exit after showing what yath thinks your options mean
175
176
177 =item --version
178
179 =item -V
180
181 =item --no-version
182
183 Exit after showing a helpful usage message
184
185
186 =back
187
188 =head3 Plugins
189
190 =over 4
191
192 =item --no-scan-plugins
193
194 =item --no-no-scan-plugins
195
196 Normally yath scans for and loads all App::Yath::Plugin::* modules in order to bring in command-line options they may provide. This flag will disable that. This is useful if you have a naughty plugin that is loading other modules when it should not.
197
198
199 =item --plugins PLUGIN
200
201 =item --plugins +App::Yath::Plugin::PLUGIN
202
203 =item --plugins PLUGIN=arg1,arg2,...
204
205 =item --plugin PLUGIN
206
207 =item --plugin +App::Yath::Plugin::PLUGIN
208
209 =item --plugin PLUGIN=arg1,arg2,...
210
211 =item -pPLUGIN
212
213 =item --no-plugins
214
215 Load a yath plugin.
216
217 Can be specified multiple times
218
219
220 =back
221
222 =head2 COMMAND OPTIONS
223
224 =head3 Cover Options
225
226 =over 4
227
228 =item --cover-aggregator ByTest
229
230 =item --cover-aggregator ByRun
231
232 =item --cover-aggregator +Custom::Aggregator
233
234 =item --cover-agg ByTest
235
236 =item --cover-agg ByRun
237
238 =item --cover-agg +Custom::Aggregator
239
240 =item --no-cover-aggregator
241
242 Choose a custom aggregator subclass
243
244
245 =item --cover-class ARG
246
247 =item --cover-class=ARG
248
249 =item --no-cover-class
250
251 Choose a Test2::Plugin::Cover subclass
252
253
254 =item --cover-dirs ARG
255
256 =item --cover-dirs=ARG
257
258 =item --cover-dir ARG
259
260 =item --cover-dir=ARG
261
262 =item --no-cover-dirs
263
264 NO DESCRIPTION - FIX ME
265
266 Can be specified multiple times
267
268
269 =item --cover-exclude-dirs ARG
270
271 =item --cover-exclude-dirs=ARG
272
273 =item --cover-exclude-dir ARG
274
275 =item --cover-exclude-dir=ARG
276
277 =item --no-cover-exclude-dirs
278
279 Directory to leave out of file coverage and coverage metrics, along with everything under it at any depth. May be specified multiple times. Wildcards are expanded when the option is parsed, so a pattern matching nothing excludes nothing. Values are word-split first, so a path containing whitespace must be quoted or backslash-escaped. A resolved path may not contain a comma.
280
281 Can be specified multiple times
282
283
284 =item --cover-exclude-private
285
286 =item --no-cover-exclude-private
287
288
289
290
291 =item --cover-files
292
293 =item --no-cover-files
294
295 Use Test2::Plugin::Cover to collect coverage data for what files are touched by what tests. Unlike Devel::Cover this has very little performance impact (About 4% difference)
296
297
298 =item --cover-from path/to/log.jsonl
299
300 =item --cover-from http://example.com/coverage
301
302 =item --cover-from path/to/coverage.jsonl
303
304 =item --no-cover-from
305
306 This can be a test log, a coverage dump (old style json or new jsonl format), or a url to any of the previous. Tests will not be run if the file/url is invalid.
307
308
309 =item --cover-from-type json
310
311 =item --cover-from-type jsonl
312
313 =item --cover-from-type log
314
315 =item --no-cover-from-type
316
317 File type for coverage source. Usually it can be detected, but when it cannot be you should specify. "json" is old style single-blob coverage data, "jsonl" is the new by-test style, "log" is a logfile from a previous run.
318
319
320 =item --cover-manager My::Coverage::Manager
321
322 =item --no-cover-manager
323
324 Coverage 'from' manager to use when coverage data does not provide one
325
326
327 =item --cover-maybe-from path/to/log.jsonl
328
329 =item --cover-maybe-from http://example.com/coverage
330
331 =item --cover-maybe-from path/to/coverage.jsonl
332
333 =item --no-cover-maybe-from
334
335 This can be a test log, a coverage dump (old style json or new jsonl format), or a url to any of the previous. Tests will continue even if the coverage file/url is invalid.
336
337
338 =item --cover-maybe-from-type json
339
340 =item --cover-maybe-from-type jsonl
341
342 =item --cover-maybe-from-type log
343
344 =item --no-cover-maybe-from-type
345
346 Same as "from_type" but for "maybe_from". Defaults to "from_type" if that is specified, otherwise auto-detect
347
348
349 =item --cover-metrics
350
351 =item --no-cover-metrics
352
353
354
355
356 =item --cover-types ARG
357
358 =item --cover-types=ARG
359
360 =item --cover-type ARG
361
362 =item --cover-type=ARG
363
364 =item --no-cover-types
365
366 NO DESCRIPTION - FIX ME
367
368 Can be specified multiple times
369
370
371 =item --cover-write
372
373 =item --cover-write=coverage.jsonl
374
375 =item --cover-write=coverage.json
376
377 =item --no-cover-write
378
379 Create a json or jsonl file of all coverage data seen during the run (This implies --cover-files).
380
381
382 =back
383
384 =head3 Display Options
385
386 =over 4
387
388 =item --color
389
390 =item --no-color
391
392 Turn color on, default is true if STDOUT is a TTY.
393
394
395 =item --hide-runner-output
396
397 =item --no-hide-runner-output
398
399 Hide output from the runner, showing only test output. (See Also truncate_runner_output)
400
401
402 =item --no-final-table
403
404 =item --no-no-final-table
405
406 When printing final results, don't use table-style display
407
408
409 =item --no-wrap
410
411 =item --no-no-wrap
412
413 Do not do fancy text-wrapping, let the terminal handle it
414
415
416 =item --progress
417
418 =item --no-progress
419
420 Toggle progress indicators. On by default if STDOUT is a TTY. You can use --no-progress to disable the 'events seen' counter and buffered event pre-display
421
422
423 =item --quiet
424
425 =item -q
426
427 =item --no-quiet
428
429 Be very quiet.
430
431 Can be specified multiple times
432
433
434 =item --renderers +My::Renderer
435
436 =item --renderers Renderer=arg1,arg2,...
437
438 =item --renderer +My::Renderer
439
440 =item --renderer Renderer=arg1,arg2,...
441
442 =item --no-renderers
443
444 Specify renderers, (Default: "Formatter=Test2"). Use "+" to give a fully qualified module name. Without "+" "Test2::Harness::Renderer::" will be prepended to your argument.
445
446 Can be specified multiple times. If the same key is listed multiple times the value lists will be appended together.
447
448
449 =item --show-times
450
451 =item -T
452
453 =item --no-show-times
454
455 Show the timing data for each job
456
457
458 =item --term-width 80
459
460 =item --term-width 200
461
462 =item --term-size 80
463
464 =item --term-size 200
465
466 =item --no-term-width
467
468 Alternative to setting $TABLE_TERM_SIZE. Setting this will override the terminal width detection to the number of characters specified.
469
470
471 =item --truncate-runner-output
472
473 =item --no-truncate-runner-output
474
475 Only show runner output that was generated after the current command. This is only useful with a persistent runner.
476
477
478 =item --verbose
479
480 =item -v
481
482 =item --no-verbose
483
484 Be more verbose
485
486 Can be specified multiple times
487
488
489 =back
490
491 =head3 Finder Options
492
493 =over 4
494
495 =item --changed path/to/file
496
497 =item --no-changed
498
499 Specify one or more files as having been changed.
500
501 Can be specified multiple times
502
503
504 =item --changed-only
505
506 =item --no-changed-only
507
508 Only search for tests for changed files (Requires a coverage data source, also requires a list of changes either from the --changed option, or a plugin that implements changed_files() or changed_diff())
509
510
511 =item --changes-diff path/to/diff.diff
512
513 =item --no-changes-diff
514
515 Path to a diff file that should be used to find changed files for use with --changed-only. This must be in the same format as `git diff -W --minimal -U1000000`
516
517
518 =item --changes-exclude-file path/to/file
519
520 =item --no-changes-exclude-file
521
522 Specify one or more files to ignore when looking at changes
523
524 Can be specified multiple times
525
526
527 =item --changes-exclude-loads
528
529 =item --no-changes-exclude-loads
530
531 Exclude coverage tests which only load changed files, but never call code from them. (default: off)
532
533
534 =item --changes-exclude-nonsub
535
536 =item --no-changes-exclude-nonsub
537
538 Exclude changes outside of subroutines (perl files only) (default: off)
539
540
541 =item --changes-exclude-opens
542
543 =item --no-changes-exclude-opens
544
545 Exclude coverage tests which only open() changed files, but never call code from them. (default: off)
546
547
548 =item --changes-exclude-pattern '(apple|pear|orange)'
549
550 =item --no-changes-exclude-pattern
551
552 Ignore files matching this pattern when looking for changes. Your pattern will be inserted unmodified into a `$file =~ m/$pattern/` check.
553
554 Can be specified multiple times
555
556
557 =item --changes-filter-file path/to/file
558
559 =item --no-changes-filter-file
560
561 Specify one or more files to check for changes. Changes to other files will be ignored
562
563 Can be specified multiple times
564
565
566 =item --changes-filter-pattern '(apple|pear|orange)'
567
568 =item --no-changes-filter-pattern
569
570 Specify a pattern for change checking. When only running tests for changed files this will limit which files are checked for changes. Only files that match this pattern will be checked. Your pattern will be inserted unmodified into a `$file =~ m/$pattern/` check.
571
572 Can be specified multiple times
573
574
575 =item --changes-include-whitespace
576
577 =item --no-changes-include-whitespace
578
579 Include changed lines that are whitespace only (default: off)
580
581
582 =item --changes-plugin Git
583
584 =item --changes-plugin +App::Yath::Plugin::Git
585
586 =item --no-changes-plugin
587
588 What plugin should be used to detect changed files.
589
590
591 =item --default-at-search ARG
592
593 =item --default-at-search=ARG
594
595 =item --no-default-at-search
596
597 Specify the default file/dir search when 'AUTHOR_TESTING' is set. Defaults to './xt'. The default AT search is only used if no files were specified at the command line
598
599 Can be specified multiple times
600
601
602 =item --default-search ARG
603
604 =item --default-search=ARG
605
606 =item --no-default-search
607
608 Specify the default file/dir search. defaults to './t', './t2', and 'test.pl'. The default search is only used if no files were specified at the command line
609
610 Can be specified multiple times
611
612
613 =item --durations file.json
614
615 =item --durations http://example.com/durations.json
616
617 =item --no-durations
618
619 Point at a json file or url which has a hash of relative test filenames as keys, and 'SHORT', 'MEDIUM', or 'LONG' as values. This will override durations listed in the file headers. An exception will be thrown if the durations file or url does not work.
620
621
622 =item --durations-threshold ARG
623
624 =item --durations-threshold=ARG
625
626 =item --Dt ARG
627
628 =item --Dt=ARG
629
630 =item --no-durations-threshold
631
632 Only fetch duration data if running at least this number of tests. Default (-j value + 1)
633
634
635 =item --exclude-file t/nope.t
636
637 =item --no-exclude-file
638
639 Exclude a file from testing
640
641 Can be specified multiple times
642
643
644 =item --exclude-list file.txt
645
646 =item --exclude-list http://example.com/exclusions.txt
647
648 =item --no-exclude-list
649
650 Point at a file or url which has a new line separated list of test file names to exclude from testing. Starting a line with a '#' will comment it out (for compatibility with Test2::Aggregate list files).
651
652 Can be specified multiple times
653
654
655 =item --exclude-pattern t/nope.t
656
657 =item --no-exclude-pattern
658
659 Exclude a pattern from testing, matched using m/$PATTERN/
660
661 Can be specified multiple times
662
663
664 =item --extension ARG
665
666 =item --extension=ARG
667
668 =item --ext ARG
669
670 =item --ext=ARG
671
672 =item --no-extension
673
674 Specify valid test filename extensions, default: t and t2
675
676 Can be specified multiple times
677
678
679 =item --maybe-durations file.json
680
681 =item --maybe-durations http://example.com/durations.json
682
683 =item --no-maybe-durations
684
685 Point at a json file or url which has a hash of relative test filenames as keys, and 'SHORT', 'MEDIUM', or 'LONG' as values. This will override durations listed in the file headers. An exception will be thrown if the durations file or url does not work.
686
687
688 =item --no-long
689
690 =item --no-no-long
691
692 Do not run tests that have their duration flag set to 'LONG'
693
694
695 =item --only-long
696
697 =item --no-only-long
698
699 Only run tests that have their duration flag set to 'LONG'
700
701
702 =item --rerun
703
704 =item --rerun=path/to/log.jsonl
705
706 =item --rerun=plugin_specific_string
707
708 =item --no-rerun
709
710 Re-Run tests from a previous run from a log file (or last log file). Plugins can intercept this, such as YathUIDB which will grab a run UUID and derive tests to re-run from that.
711
712
713 =item --rerun-all
714
715 =item --rerun-all=path/to/log.jsonl
716
717 =item --rerun-all=plugin_specific_string
718
719 =item --no-rerun-all
720
721 Re-Run all tests from a previous run from a log file (or last log file). Plugins can intercept this, such as YathUIDB which will grab a run UUID and derive tests to re-run from that.
722
723
724 =item --rerun-failed
725
726 =item --rerun-failed=path/to/log.jsonl
727
728 =item --rerun-failed=plugin_specific_string
729
730 =item --no-rerun-failed
731
732 Re-Run failed tests from a previous run from a log file (or last log file). Plugins can intercept this, such as YathUIDB which will grab a run UUID and derive tests to re-run from that.
733
734
735 =item --rerun-missed
736
737 =item --rerun-missed=path/to/log.jsonl
738
739 =item --rerun-missed=plugin_specific_string
740
741 =item --no-rerun-missed
742
743 Run missed tests from a previously aborted/stopped run from a log file (or last log file). Plugins can intercept this, such as YathUIDB which will grab a run UUID and derive tests to re-run from that.
744
745
746 =item --rerun-modes failed,missed,...
747
748 =item --rerun-modes all
749
750 =item --rerun-modes failed
751
752 =item --rerun-modes missed
753
754 =item --rerun-modes passed
755
756 =item --rerun-modes retried
757
758 =item --rerun-mode failed,missed,...
759
760 =item --rerun-mode all
761
762 =item --rerun-mode failed
763
764 =item --rerun-mode missed
765
766 =item --rerun-mode passed
767
768 =item --rerun-mode retried
769
770 =item --no-rerun-modes
771
772 Pick which test categories to run
773
774 Can be specified multiple times
775
776
777 =item --rerun-passed
778
779 =item --rerun-passed=path/to/log.jsonl
780
781 =item --rerun-passed=plugin_specific_string
782
783 =item --no-rerun-passed
784
785 Re-Run passed tests from a previous run from a log file (or last log file). Plugins can intercept this, such as YathUIDB which will grab a run UUID and derive tests to re-run from that.
786
787
788 =item --rerun-plugin Foo
789
790 =item --rerun-plugin +App::Yath::Plugin::Foo
791
792 =item --no-rerun-plugin
793
794 What plugin(s) should be used for rerun (will fallback to other plugins if the listed ones decline the value, this is just used to set an order of priority)
795
796 Can be specified multiple times
797
798
799 =item --rerun-retried
800
801 =item --rerun-retried=path/to/log.jsonl
802
803 =item --rerun-retried=plugin_specific_string
804
805 =item --no-rerun-retried
806
807 Re-Run retried tests from a previous run from a log file (or last log file). Plugins can intercept this, such as YathUIDB which will grab a run UUID and derive tests to re-run from that.
808
809
810 =item --search ARG
811
812 =item --search=ARG
813
814 =item --no-search
815
816 List of tests and test directories to use instead of the default search paths. Typically these can simply be listed as command line arguments without the --search prefix.
817
818 Can be specified multiple times
819
820
821 =item --show-changed-files
822
823 =item --no-show-changed-files
824
825 Print a list of changed files if any are found
826
827
828 =back
829
830 =head3 Formatter Options
831
832 =over 4
833
834 =item --formatter ARG
835
836 =item --formatter=ARG
837
838 =item --no-formatter
839
840 NO DESCRIPTION - FIX ME
841
842
843 =item --qvf
844
845 =item --no-qvf
846
847 [Q]uiet, but [V]erbose on [F]ailure. Hide all output from tests when they pass, except to say they passed. If a test fails then ALL output from the test is verbosely output.
848
849
850 =item --show-job-end
851
852 =item --no-show-job-end
853
854 Show output when a job ends. (Default: on)
855
856
857 =item --show-job-info
858
859 =item --no-show-job-info
860
861 Show the job configuration when a job starts. (Default: off, unless -vv)
862
863
864 =item --show-job-launch
865
866 =item --no-show-job-launch
867
868 Show output for the start of a job. (Default: off unless -v)
869
870
871 =item --show-run-info
872
873 =item --no-show-run-info
874
875 Show the run configuration when a run starts. (Default: off, unless -vv)
876
877
878 =back
879
880 =head3 Git Options
881
882 =over 4
883
884 =item --git-change-base master
885
886 =item --git-change-base HEAD^
887
888 =item --git-change-base df22abe4
889
890 =item --no-git-change-base
891
892 Find files changed by all commits in the current branch from most recent stopping when a commit is found that is also present in the history of the branch/commit specified as the change base.
893
894
895 =back
896
897 =head3 Help and Debugging
898
899 =over 4
900
901 =item --dummy
902
903 =item -d
904
905 =item --no-dummy
906
907 Dummy run, do not actually execute anything
908
909 Can also be set with the following environment variables: C<T2_HARNESS_DUMMY>
910
911
912 =item --help
913
914 =item -h
915
916 =item --no-help
917
918 exit after showing help information
919
920
921 =item --interactive
922
923 =item -i
924
925 =item --no-interactive
926
927 Use interactive mode, 1 test at a time, stdin forwarded to it
928
929
930 =item --keep-dirs
931
932 =item --keep_dir
933
934 =item -k
935
936 =item --no-keep-dirs
937
938 Do not delete directories when done. This is useful if you want to inspect the directories used for various commands.
939
940
941 =item --procname-prefix ARG
942
943 =item --procname-prefix=ARG
944
945 =item --no-procname-prefix
946
947 Add a prefix to all proc names (as seen by ps).
948
949
950 =item --summary
951
952 =item --summary=/path/to/summary.json
953
954 =item --no-summary
955
956 Write out a summary json file, if no path is provided 'summary.json' will be used. The .json extension is added automatically if omitted.
957
958
959 =back
960
961 =head3 Logging Options
962
963 =over 4
964
965 =item --bzip2
966
967 =item --bz2
968
969 =item --bzip2_log
970
971 =item -B
972
973 =item --no-bzip2
974
975 Use bzip2 compression when writing the log. This option implies -L. The .bz2 prefix is added to log file name for you
976
977
978 =item --gzip
979
980 =item --gz
981
982 =item --gzip_log
983
984 =item -G
985
986 =item --no-gzip
987
988 Use gzip compression when writing the log. This option implies -L. The .gz prefix is added to log file name for you
989
990
991 =item --log
992
993 =item -L
994
995 =item --no-log
996
997 Turn on logging
998
999
1000 =item --log-dir ARG
1001
1002 =item --log-dir=ARG
1003
1004 =item --no-log-dir
1005
1006 Specify a log directory. Will fall back to the system temp dir.
1007
1008
1009 =item --log-file ARG
1010
1011 =item --log-file=ARG
1012
1013 =item -F ARG
1014
1015 =item -F=ARG
1016
1017 =item --no-log-file
1018
1019 Specify the name of the log file. This option implies -L.
1020
1021
1022 =item --log-file-format ARG
1023
1024 =item --log-file-format=ARG
1025
1026 =item --lff ARG
1027
1028 =item --lff=ARG
1029
1030 =item --no-log-file-format
1031
1032 Specify the format for automatically-generated log files. Overridden by --log-file, if given. This option implies -L (Default: \$YATH_LOG_FILE_FORMAT, if that is set, or else "%!P%Y-%m-%d~%H:%M:%S~%!U~%!p.jsonl"). This is a string in which percent-escape sequences will be replaced as per POSIX::strftime. The following special escape sequences are also replaced: (%!P : Project name followed by a ~, if a project is defined, otherwise empty string) (%!U : the unique test run ID) (%!p : the process ID) (%!S : the number of seconds since local midnight UTC)
1033
1034 Can also be set with the following environment variables: C<YATH_LOG_FILE_FORMAT>, C<TEST2_HARNESS_LOG_FORMAT>
1035
1036
1037 =back
1038
1039 =head3 Notification Options
1040
1041 =over 4
1042
1043 =item --notify-email [email protected]
1044
1045 =item --no-notify-email
1046
1047 Email the test results to the specified email address(es)
1048
1049 Can be specified multiple times
1050
1051
1052 =item --notify-email-fail [email protected]
1053
1054 =item --no-notify-email-fail
1055
1056 Email failing results to the specified email address(es)
1057
1058 Can be specified multiple times
1059
1060
1061 =item --notify-email-from [email protected]
1062
1063 =item --no-notify-email-from
1064
1065 If any email is sent, this is who it will be from
1066
1067
1068 =item --notify-email-owner
1069
1070 =item --no-notify-email-owner
1071
1072 Email the owner of broken tests files upon failure. Add `# HARNESS-META-OWNER [email protected]` to the top of a test file to give it an owner
1073
1074
1075 =item --notify-no-batch-email
1076
1077 =item --no-notify-no-batch-email
1078
1079 Usually owner failures are sent as a single batch at the end of testing. Toggle this to send failures as they happen.
1080
1081
1082 =item --notify-no-batch-slack
1083
1084 =item --no-notify-no-batch-slack
1085
1086 Usually owner failures are sent as a single batch at the end of testing. Toggle this to send failures as they happen.
1087
1088
1089 =item --notify-slack '#foo'
1090
1091 =item --notify-slack '@bar'
1092
1093 =item --no-notify-slack
1094
1095 Send results to a slack channel and/or user
1096
1097 Can be specified multiple times
1098
1099
1100 =item --notify-slack-fail '#foo'
1101
1102 =item --notify-slack-fail '@bar'
1103
1104 =item --no-notify-slack-fail
1105
1106 Send failing results to a slack channel and/or user
1107
1108 Can be specified multiple times
1109
1110
1111 =item --notify-slack-owner
1112
1113 =item --no-notify-slack-owner
1114
1115 Send slack notifications to the slack channels/users listed in test meta-data when tests fail.
1116
1117
1118 =item --notify-slack-url https://hooks.slack.com/...
1119
1120 =item --no-notify-slack-url
1121
1122 Specify an API endpoint for slack webhook integrations
1123
1124
1125 =item --notify-text ARG
1126
1127 =item --notify-text=ARG
1128
1129 =item --message ARG
1130
1131 =item --message=ARG
1132
1133 =item --msg ARG
1134
1135 =item --msg=ARG
1136
1137 =item --no-notify-text
1138
1139 Add a custom text snippet to email/slack notifications
1140
1141
1142 =item --notify-text-module ARG
1143
1144 =item --notify-text-module=ARG
1145
1146 =item --message_module ARG
1147
1148 =item --message_module=ARG
1149
1150 =item --no-notify-text-module
1151
1152 Use the specified module to generate messages for emails and/or slack.
1153
1154
1155 =back
1156
1157 =head3 Run Options
1158
1159 =over 4
1160
1161 =item --author-testing
1162
1163 =item -A
1164
1165 =item --no-author-testing
1166
1167 This will set the AUTHOR_TESTING environment to true
1168
1169
1170 =item --dbi-profiling
1171
1172 =item --no-dbi-profiling
1173
1174 Use Test2::Plugin::DBIProfile to collect database profiling data
1175
1176
1177 =item --env-var VAR=VAL
1178
1179 =item -EVAR=VAL
1180
1181 =item -E VAR=VAL
1182
1183 =item --no-env-var
1184
1185 Set environment variables to set when each test is run.
1186
1187 Can be specified multiple times
1188
1189
1190 =item --event-uuids
1191
1192 =item --uuids
1193
1194 =item --no-event-uuids
1195
1196 Use Test2::Plugin::UUID inside tests (default: on)
1197
1198
1199 =item --fields name:details
1200
1201 =item --fields JSON_STRING
1202
1203 =item -f name:details
1204
1205 =item -f JSON_STRING
1206
1207 =item --no-fields
1208
1209 Add custom data to the harness run
1210
1211 Can be specified multiple times
1212
1213
1214 =item --input ARG
1215
1216 =item --input=ARG
1217
1218 =item --no-input
1219
1220 Input string to be used as standard input for ALL tests. See also: --input-file
1221
1222
1223 =item --input-file ARG
1224
1225 =item --input-file=ARG
1226
1227 =item --no-input-file
1228
1229 Use the specified file as standard input to ALL tests
1230
1231
1232 =item --io-events
1233
1234 =item --no-io-events
1235
1236 Use Test2::Plugin::IOEvents inside tests to turn all prints into test2 events (default: off)
1237
1238
1239 =item --link 'https://travis.work/builds/42'
1240
1241 =item --link 'https://jenkins.work/job/42'
1242
1243 =item --link 'https://buildbot.work/builders/foo/builds/42'
1244
1245 =item --no-link
1246
1247 Provide one or more links people can follow to see more about this run.
1248
1249 Can be specified multiple times
1250
1251
1252 =item --load ARG
1253
1254 =item --load=ARG
1255
1256 =item --load-module ARG
1257
1258 =item --load-module=ARG
1259
1260 =item -m ARG
1261
1262 =item -m=ARG
1263
1264 =item --no-load
1265
1266 Load a module in each test (after fork). The "import" method is not called.
1267
1268 Can be specified multiple times
1269
1270
1271 =item --load-import Module
1272
1273 =item --load-import Module=import_arg1,arg2,...
1274
1275 =item --loadim Module
1276
1277 =item --loadim Module=import_arg1,arg2,...
1278
1279 =item -M Module
1280
1281 =item -M Module=import_arg1,arg2,...
1282
1283 =item --no-load-import
1284
1285 Load a module in each test (after fork). Import is called.
1286
1287 Can be specified multiple times. If the same key is listed multiple times the value lists will be appended together.
1288
1289
1290 =item --mem-usage
1291
1292 =item --no-mem-usage
1293
1294 Use Test2::Plugin::MemUsage inside tests (default: on)
1295
1296
1297 =item --retry ARG
1298
1299 =item --retry=ARG
1300
1301 =item -r ARG
1302
1303 =item -r=ARG
1304
1305 =item --no-retry
1306
1307 Run any jobs that failed a second time. NOTE: --retry=1 means failing tests will be attempted twice!
1308
1309
1310 =item --retry-isolated
1311
1312 =item --retry-iso
1313
1314 =item --no-retry-isolated
1315
1316 If true then any job retries will be done in isolation (as though -j1 was set)
1317
1318
1319 =item --run-id
1320
1321 =item --id
1322
1323 =item --no-run-id
1324
1325 Set a specific run-id. (Default: a UUID)
1326
1327
1328 =item --test-args ARG
1329
1330 =item --test-args=ARG
1331
1332 =item --no-test-args
1333
1334 Arguments to pass in as @ARGV for all tests that are run. These can be provided easier using the '::' argument separator.
1335
1336 Can be specified multiple times
1337
1338
1339 =item --stream
1340
1341 =item --no-stream
1342
1343 Use the stream formatter (default is on)
1344
1345
1346 =item --tap
1347
1348 =item --TAP
1349
1350 =item ----no-stream
1351
1352 =item --no-tap
1353
1354 The TAP format is lossy and clunky. Test2::Harness normally uses a newer streaming format to receive test results. There are old/legacy tests where this causes problems, in which case setting --TAP or --no-stream can help.
1355
1356
1357 =back
1358
1359 =head3 YathUI Options
1360
1361 =over 4
1362
1363 =item --yathui-api-key ARG
1364
1365 =item --yathui-api-key=ARG
1366
1367 =item --no-yathui-api-key
1368
1369 Yath-UI API key. This is not necessary if your Yath-UI instance is set to single-user
1370
1371
1372 =item --yathui-coverage
1373
1374 =item --no-yathui-coverage
1375
1376 Poll coverage data from Yath-UI to determine what tests should be run for changed files
1377
1378
1379 =item --yathui-durations
1380
1381 =item --no-yathui-durations
1382
1383 Poll duration data from Yath-UI to help order tests efficiently
1384
1385
1386 =item --yathui-grace
1387
1388 =item --no-yathui-grace
1389
1390 If yath cannot connect to yath-ui it normally throws an error, use this to make it fail gracefully. You get a warning, but things keep going.
1391
1392
1393 =item --yathui-long-duration 10
1394
1395 =item --no-yathui-long-duration
1396
1397 Minimum duration length (seconds) before a test goes from MEDIUM to LONG
1398
1399
1400 =item --yathui-medium-duration 5
1401
1402 =item --no-yathui-medium-duration
1403
1404 Minimum duration length (seconds) before a test goes from SHORT to MEDIUM
1405
1406
1407 =item --yathui-mode summary
1408
1409 =item --yathui-mode qvf
1410
1411 =item --yathui-mode qvfd
1412
1413 =item --yathui-mode complete
1414
1415 =item --no-yathui-mode
1416
1417 Set the upload mode (default 'qvfd')
1418
1419
1420 =item --yathui-project ARG
1421
1422 =item --yathui-project=ARG
1423
1424 =item --no-yathui-project
1425
1426 The Yath-UI project for your test results
1427
1428
1429 =item --yathui-retry
1430
1431 =item --no-yathui-retry
1432
1433 How many times to try an operation before giving up
1434
1435 Can be specified multiple times
1436
1437
1438 =item --yathui-upload
1439
1440 =item --no-yathui-upload
1441
1442 Upload the log to Yath-UI
1443
1444
1445 =item --yathui-url http://my-yath-ui.com/...
1446
1447 =item --uri http://my-yath-ui.com/...
1448
1449 =item --no-yathui-url
1450
1451 Yath-UI url
1452
1453
1454 =back
1455
1456 =head3 NO CATEGORY - FIX ME
1457
1458 =over 4
1459
1460 =item --check-reload-state
1461
1462 =item --no-check-reload-state
1463
1464 Abort the run if there are unfixes reload errors and show a confirmation dialogue for unfixed reload warnings.
1465
1466
1467 =back
1468
1469 =head1 SOURCE
1470
1471 The source code repository for Test2-Harness can be found at
1472 F<http://github.com/Test-More/Test2-Harness/>.
1473
1474 =head1 MAINTAINERS
1475
1476 =over 4
1477
1478 =item Chad Granum E<lt>[email protected]<gt>
1479
1480 =back
1481
1482 =head1 AUTHORS
1483
1484 =over 4
1485
1486 =item Chad Granum E<lt>[email protected]<gt>
1487
1488 =back
1489
1490 =head1 COPYRIGHT
1491
1492 Copyright 2026 Chad Granum E<lt>[email protected]<gt>.
1493
1494 This program is free software; you can redistribute it and/or
1495 modify it under the same terms as Perl itself.
1496
1497 See F<http://dev.perl.org/licenses/>
1498
1499 =cut
1500