Debian Codegraph @

lib/App/Yath/Command/do.pm

raw
1 package App::Yath::Command::do;
2 use strict;
3 use warnings;
4
5 our $VERSION = '1.000179';
6
7 use Test2::Harness::Util::File::JSON;
8
9 use Test2::Harness::Util qw/open_file/;
10
11 use parent 'App::Yath::Command';
12 use Test2::Harness::Util::HashBase;
13
14 sub group { '' }
15
16 sub summary { "Run tests using 'run' or 'test', same as the default command, but explicit." }
17 sub cli_args { "[run or test args]" }
18
19 sub description {
20 return <<" EOT";
21 This is the same as running yath without a command, except that it will not
22 fail on CLI parsing issues that often get mistaken for commands.
23
24 If there is a persistent runner then the 'run' command is used, otherwise the
25 'test' command is used.
26 EOT
27 }
28
29 sub run {
30 # This file is actually just a stub for the magic of 'do'. Code is not executed.
31 die "This should not be reachable";
32 }
33
34
35 1;
36
37 __END__
38
39 =pod
40
41 =encoding UTF-8
42
43 =head1 NAME
44
45 App::Yath::Command::do - Run tests using 'run' or 'test', same as the default command, but explicit.
46
47 =head1 DESCRIPTION
48
49 This is the same as running yath without a command, except that it will not
50 fail on CLI parsing issues that often get mistaken for commands.
51
52 If there is a persistent runner then the 'run' command is used, otherwise the
53 'test' command is used.
54
55
56 =head1 USAGE
57
58 $ yath [YATH OPTIONS] do [COMMAND OPTIONS]
59
60 =head2 YATH OPTIONS
61
62 =head3 Developer
63
64 =over 4
65
66 =item --dev-lib
67
68 =item --dev-lib=lib
69
70 =item -D
71
72 =item -D=lib
73
74 =item -Dlib
75
76 =item --no-dev-lib
77
78 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.
79
80 Can be specified multiple times
81
82
83 =back
84
85 =head3 Environment
86
87 =over 4
88
89 =item --persist-dir ARG
90
91 =item --persist-dir=ARG
92
93 =item --no-persist-dir
94
95 Where to find persistence files.
96
97
98 =item --persist-file ARG
99
100 =item --persist-file=ARG
101
102 =item --pfile ARG
103
104 =item --pfile=ARG
105
106 =item --no-persist-file
107
108 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.
109
110
111 =item --project ARG
112
113 =item --project=ARG
114
115 =item --project-name ARG
116
117 =item --project-name=ARG
118
119 =item --no-project
120
121 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.
122
123
124 =back
125
126 =head3 Help and Debugging
127
128 =over 4
129
130 =item --show-opts
131
132 =item --no-show-opts
133
134 Exit after showing what yath thinks your options mean
135
136
137 =item --version
138
139 =item -V
140
141 =item --no-version
142
143 Exit after showing a helpful usage message
144
145
146 =back
147
148 =head3 Plugins
149
150 =over 4
151
152 =item --no-scan-plugins
153
154 =item --no-no-scan-plugins
155
156 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.
157
158
159 =item --plugins PLUGIN
160
161 =item --plugins +App::Yath::Plugin::PLUGIN
162
163 =item --plugins PLUGIN=arg1,arg2,...
164
165 =item --plugin PLUGIN
166
167 =item --plugin +App::Yath::Plugin::PLUGIN
168
169 =item --plugin PLUGIN=arg1,arg2,...
170
171 =item -pPLUGIN
172
173 =item --no-plugins
174
175 Load a yath plugin.
176
177 Can be specified multiple times
178
179
180 =back
181
182 =head2 COMMAND OPTIONS
183
184 =head3 Cover Options
185
186 =over 4
187
188 =item --cover-aggregator ByTest
189
190 =item --cover-aggregator ByRun
191
192 =item --cover-aggregator +Custom::Aggregator
193
194 =item --cover-agg ByTest
195
196 =item --cover-agg ByRun
197
198 =item --cover-agg +Custom::Aggregator
199
200 =item --no-cover-aggregator
201
202 Choose a custom aggregator subclass
203
204
205 =item --cover-class ARG
206
207 =item --cover-class=ARG
208
209 =item --no-cover-class
210
211 Choose a Test2::Plugin::Cover subclass
212
213
214 =item --cover-dirs ARG
215
216 =item --cover-dirs=ARG
217
218 =item --cover-dir ARG
219
220 =item --cover-dir=ARG
221
222 =item --no-cover-dirs
223
224 NO DESCRIPTION - FIX ME
225
226 Can be specified multiple times
227
228
229 =item --cover-exclude-dirs ARG
230
231 =item --cover-exclude-dirs=ARG
232
233 =item --cover-exclude-dir ARG
234
235 =item --cover-exclude-dir=ARG
236
237 =item --no-cover-exclude-dirs
238
239 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.
240
241 Can be specified multiple times
242
243
244 =item --cover-exclude-private
245
246 =item --no-cover-exclude-private
247
248
249
250
251 =item --cover-files
252
253 =item --no-cover-files
254
255 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)
256
257
258 =item --cover-from path/to/log.jsonl
259
260 =item --cover-from http://example.com/coverage
261
262 =item --cover-from path/to/coverage.jsonl
263
264 =item --no-cover-from
265
266 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.
267
268
269 =item --cover-from-type json
270
271 =item --cover-from-type jsonl
272
273 =item --cover-from-type log
274
275 =item --no-cover-from-type
276
277 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.
278
279
280 =item --cover-manager My::Coverage::Manager
281
282 =item --no-cover-manager
283
284 Coverage 'from' manager to use when coverage data does not provide one
285
286
287 =item --cover-maybe-from path/to/log.jsonl
288
289 =item --cover-maybe-from http://example.com/coverage
290
291 =item --cover-maybe-from path/to/coverage.jsonl
292
293 =item --no-cover-maybe-from
294
295 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.
296
297
298 =item --cover-maybe-from-type json
299
300 =item --cover-maybe-from-type jsonl
301
302 =item --cover-maybe-from-type log
303
304 =item --no-cover-maybe-from-type
305
306 Same as "from_type" but for "maybe_from". Defaults to "from_type" if that is specified, otherwise auto-detect
307
308
309 =item --cover-metrics
310
311 =item --no-cover-metrics
312
313
314
315
316 =item --cover-types ARG
317
318 =item --cover-types=ARG
319
320 =item --cover-type ARG
321
322 =item --cover-type=ARG
323
324 =item --no-cover-types
325
326 NO DESCRIPTION - FIX ME
327
328 Can be specified multiple times
329
330
331 =item --cover-write
332
333 =item --cover-write=coverage.jsonl
334
335 =item --cover-write=coverage.json
336
337 =item --no-cover-write
338
339 Create a json or jsonl file of all coverage data seen during the run (This implies --cover-files).
340
341
342 =back
343
344 =head3 Git Options
345
346 =over 4
347
348 =item --git-change-base master
349
350 =item --git-change-base HEAD^
351
352 =item --git-change-base df22abe4
353
354 =item --no-git-change-base
355
356 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.
357
358
359 =back
360
361 =head3 Help and Debugging
362
363 =over 4
364
365 =item --dummy
366
367 =item -d
368
369 =item --no-dummy
370
371 Dummy run, do not actually execute anything
372
373 Can also be set with the following environment variables: C<T2_HARNESS_DUMMY>
374
375
376 =item --help
377
378 =item -h
379
380 =item --no-help
381
382 exit after showing help information
383
384
385 =item --interactive
386
387 =item -i
388
389 =item --no-interactive
390
391 Use interactive mode, 1 test at a time, stdin forwarded to it
392
393
394 =item --keep-dirs
395
396 =item --keep_dir
397
398 =item -k
399
400 =item --no-keep-dirs
401
402 Do not delete directories when done. This is useful if you want to inspect the directories used for various commands.
403
404
405 =item --procname-prefix ARG
406
407 =item --procname-prefix=ARG
408
409 =item --no-procname-prefix
410
411 Add a prefix to all proc names (as seen by ps).
412
413
414 =back
415
416 =head3 YathUI Options
417
418 =over 4
419
420 =item --yathui-api-key ARG
421
422 =item --yathui-api-key=ARG
423
424 =item --no-yathui-api-key
425
426 Yath-UI API key. This is not necessary if your Yath-UI instance is set to single-user
427
428
429 =item --yathui-grace
430
431 =item --no-yathui-grace
432
433 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.
434
435
436 =item --yathui-long-duration 10
437
438 =item --no-yathui-long-duration
439
440 Minimum duration length (seconds) before a test goes from MEDIUM to LONG
441
442
443 =item --yathui-medium-duration 5
444
445 =item --no-yathui-medium-duration
446
447 Minimum duration length (seconds) before a test goes from SHORT to MEDIUM
448
449
450 =item --yathui-mode summary
451
452 =item --yathui-mode qvf
453
454 =item --yathui-mode qvfd
455
456 =item --yathui-mode complete
457
458 =item --no-yathui-mode
459
460 Set the upload mode (default 'qvfd')
461
462
463 =item --yathui-project ARG
464
465 =item --yathui-project=ARG
466
467 =item --no-yathui-project
468
469 The Yath-UI project for your test results
470
471
472 =item --yathui-retry
473
474 =item --no-yathui-retry
475
476 How many times to try an operation before giving up
477
478 Can be specified multiple times
479
480
481 =item --yathui-url http://my-yath-ui.com/...
482
483 =item --uri http://my-yath-ui.com/...
484
485 =item --no-yathui-url
486
487 Yath-UI url
488
489
490 =back
491
492 =head1 SOURCE
493
494 The source code repository for Test2-Harness can be found at
495 F<http://github.com/Test-More/Test2-Harness/>.
496
497 =head1 MAINTAINERS
498
499 =over 4
500
501 =item Chad Granum E<lt>[email protected]<gt>
502
503 =back
504
505 =head1 AUTHORS
506
507 =over 4
508
509 =item Chad Granum E<lt>[email protected]<gt>
510
511 =back
512
513 =head1 COPYRIGHT
514
515 Copyright 2026 Chad Granum E<lt>[email protected]<gt>.
516
517 This program is free software; you can redistribute it and/or
518 modify it under the same terms as Perl itself.
519
520 See F<http://dev.perl.org/licenses/>
521
522 =cut
523
524