@hughescr/stryker-bun-runner 1.6.0 → 1.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +442 -12
- package/dist/index.d.ts +350 -13
- package/dist/index.js +2462 -215
- package/dist/templates/coverage-preload.js +669 -24
- package/dist/templates/import-scan.js +902 -0
- package/package.json +2 -1
package/dist/index.d.ts
CHANGED
|
@@ -61,6 +61,8 @@ export declare class BunTestRunner implements TestRunner {
|
|
|
61
61
|
private readonly maxChildRss?;
|
|
62
62
|
private readonly rssCheckIntervalMs?;
|
|
63
63
|
private readonly maxSpawnDepth?;
|
|
64
|
+
/** The file a failed dry run's complete output is written to (bun.dryRunOutputFile), as the user wrote it; undefined when none is configured. */
|
|
65
|
+
private readonly dryRunOutputFile?;
|
|
64
66
|
/** Stryker's coverageAnalysis from the Stryker options; DryRunOptions.coverageAnalysis wins when given. */
|
|
65
67
|
private readonly coverageAnalysis?;
|
|
66
68
|
private preloadScriptPath?;
|
|
@@ -116,6 +118,26 @@ export declare class BunTestRunner implements TestRunner {
|
|
|
116
118
|
private fullSuiteFallbacks;
|
|
117
119
|
/** Times every run when STRYKER_BUN_PROFILE names a file; undefined otherwise (see src/run-profile.ts). */
|
|
118
120
|
private readonly profiler?;
|
|
121
|
+
/** `bun.alwaysImport` as given: the files of the eager list every dry run imports first. */
|
|
122
|
+
private readonly alwaysImport?;
|
|
123
|
+
/** `bun.importDiscovery` as given (undefined is the default, 'scan'). */
|
|
124
|
+
private readonly importDiscovery?;
|
|
125
|
+
/** Stryker's `incremental` option: the messages that name a remedy then add the --force advice. */
|
|
126
|
+
private readonly incremental;
|
|
127
|
+
/** Stryker's `inPlace` option: campaigns of one process then share the run directory (see dry-run-files.ts). */
|
|
128
|
+
private readonly inPlace;
|
|
129
|
+
/**
|
|
130
|
+
* What mutant runs take off Stryker's per-mutant timeout (rule 3.6), as this worker's dry
|
|
131
|
+
* run computed it or the registry held it (unchecked: see correctStrykerTimeout); undefined
|
|
132
|
+
* without either.
|
|
133
|
+
*/
|
|
134
|
+
private timeoutCorrectionMs?;
|
|
135
|
+
/** True once the "no usable timeout correction" debug line has been logged; it is shown once per runner. */
|
|
136
|
+
private loggedUnusableCorrection;
|
|
137
|
+
/** The campaign of this worker's dry run or of the registry, the run directory its files are in, and its watch list as a set (built once, for every mutant run's witness check). */
|
|
138
|
+
private campaign?;
|
|
139
|
+
/** True once a mutant run's unusable watch list has been warned about; it is shown once per runner. */
|
|
140
|
+
private warnedWatchListProblem;
|
|
119
141
|
/**
|
|
120
142
|
* AbortController for whichever `dryRun`/`mutantRun` child process is
|
|
121
143
|
* currently in flight, if any. Lets {@link dispose} kill an orphaned child
|
|
@@ -371,6 +393,26 @@ export declare class BunTestRunner implements TestRunner {
|
|
|
371
393
|
* Initialize the test runner
|
|
372
394
|
*/
|
|
373
395
|
init(): Promise<void>;
|
|
396
|
+
/**
|
|
397
|
+
* Reject init() with the witness's message (M-witness) while the run directory holds an
|
|
398
|
+
* abort marker of the current campaign.
|
|
399
|
+
*
|
|
400
|
+
* Stryker answers a rejected mutant run by disposing the worker, starting a new one and
|
|
401
|
+
* calling its init(); a rejection there ends the campaign without a report or an
|
|
402
|
+
* incremental file (measured on every supported core). So the worker whose mutant run
|
|
403
|
+
* the witness stopped leaves a marker, and every init() of the same campaign rejects.
|
|
404
|
+
*
|
|
405
|
+
* The marker counts only for the campaign that wrote it: its generation must be the
|
|
406
|
+
* registry's. Without inPlace that settles it, since every campaign has a run directory
|
|
407
|
+
* of its own. With inPlace the files matched by mutate must also be the ones that
|
|
408
|
+
* campaign's dry run saw (the fingerprint the registry then holds, see
|
|
409
|
+
* dry-run-files.ts): that is what lets a later campaign in the same run directory start,
|
|
410
|
+
* as Stryker starts its workers before its dry run replaces the generation, and it has
|
|
411
|
+
* written the instrumented files anew.
|
|
412
|
+
*
|
|
413
|
+
* Costs one failed read per init() when there is no marker.
|
|
414
|
+
*/
|
|
415
|
+
private rejectIfCampaignStopped;
|
|
374
416
|
/** Create/verify the run's private temp directory (see src/utils/private-temp-dir.ts) and remember it as this worker's tempDir. */
|
|
375
417
|
private ensureRunTempDir;
|
|
376
418
|
/**
|
|
@@ -439,14 +481,153 @@ export declare class BunTestRunner implements TestRunner {
|
|
|
439
481
|
*/
|
|
440
482
|
private buildTestsFromInspector;
|
|
441
483
|
/**
|
|
442
|
-
* Run all tests (dry run). Stryker always passes `options`;
|
|
484
|
+
* Run all tests (dry run). Stryker always passes `options`; its
|
|
443
485
|
* `coverageAnalysis` is read (to judge missing coverage, see
|
|
444
|
-
* checkCoverageData), falling back to the Stryker options' value
|
|
445
|
-
*
|
|
486
|
+
* checkCoverageData), falling back to the Stryker options' value, and its
|
|
487
|
+
* `timeout` (dryRunTimeoutMinutes) only to warn when another run of the tests
|
|
488
|
+
* might not fit (M-budget). bun.timeout bounds each child.
|
|
446
489
|
*/
|
|
447
490
|
dryRun(options?: DryRunOptions): Promise<DryRunResult>;
|
|
448
|
-
/**
|
|
491
|
+
/**
|
|
492
|
+
* The dry run itself; split from {@link dryRun} so its many returns all reach the profile.
|
|
493
|
+
*
|
|
494
|
+
* Which files of the eager list (E) the run that publishes results imports before the
|
|
495
|
+
* tests, and how that is established:
|
|
496
|
+
*
|
|
497
|
+
* 1. E is empty, or bun.alwaysImport keeps all of it: earlier versions' run, no scan.
|
|
498
|
+
* 2. Otherwise the import scan reads the tests' imports (see decideShape) and answers:
|
|
499
|
+
* - `full`: what the tests import covers E; one run with E imported first
|
|
500
|
+
* ({@link runFullShape});
|
|
501
|
+
* - `static`: something is left out and nothing could load it; one run with the
|
|
502
|
+
* shortened list, watched by the load sensors ({@link runStaticShape});
|
|
503
|
+
* - `dynamic`, or bun.importDiscovery 'run': a plain run of the tests is observed
|
|
504
|
+
* first, then the run that publishes ({@link runTwoRuns}).
|
|
505
|
+
*
|
|
506
|
+
* Every published run is earlier versions' inspected run with its result held back
|
|
507
|
+
* until the rules pass; nothing is persisted before that ({@link publishDryRun}).
|
|
508
|
+
*/
|
|
449
509
|
private executeDryRun;
|
|
510
|
+
/** K: the files of E that bun.alwaysImport keeps, with a warning for each pattern that keeps none. */
|
|
511
|
+
private selectAlwaysImported;
|
|
512
|
+
/** `file` relative to the dry run's project directory, as the messages show it (quoted when it must be, see displayName). */
|
|
513
|
+
private projectPathsOf;
|
|
514
|
+
/** Log `message` at `level`, and at debug, for each list it shortened, the entries it left out (see listText). */
|
|
515
|
+
private logListed;
|
|
516
|
+
/**
|
|
517
|
+
* The import scan's verdict for this dry run (the design's step 2), and its M-scan line.
|
|
518
|
+
* The scan is not even started when the runner cannot name its roots or the command line
|
|
519
|
+
* can change what it would model; either way the answer is then `dynamic`. Its time,
|
|
520
|
+
* whatever the outcome, counts towards d (rule 3.6).
|
|
521
|
+
*/
|
|
522
|
+
private decideShape;
|
|
523
|
+
/**
|
|
524
|
+
* The import scan's input: E, K, the tsconfig, and the roots (the test files bun will
|
|
525
|
+
* run, the project's `[test].preload` files and the user's `--preload` files); or why the
|
|
526
|
+
* runner cannot name them exactly, or why its command line, its environment or its bunfig
|
|
527
|
+
* (see bunfigScanProblem) can change what the tests load in a way the scan does not model.
|
|
528
|
+
*/
|
|
529
|
+
private importScanInput;
|
|
530
|
+
/** The project's tsconfig.json (or, without one, its jsconfig.json), or null when it has neither. */
|
|
531
|
+
private applicableTsconfig;
|
|
532
|
+
/** The sanitized bunfig and the test-file arguments every run of this dry run hands bun (see the inspected run's own resolution of both). */
|
|
533
|
+
private dryRunFiles;
|
|
534
|
+
/** Before each run of the tests: count it, and warn (M-budget) before a second or third when the rest of Stryker's budget may not hold it. */
|
|
535
|
+
private beforeLaunch;
|
|
536
|
+
/**
|
|
537
|
+
* Launch a published run with `list` (L) imported first: write its plan (the load
|
|
538
|
+
* sensors watch E outside L; a fresh record file), run earlier versions' inspected dry
|
|
539
|
+
* run, and read its record back.
|
|
540
|
+
*/
|
|
541
|
+
private runPublished;
|
|
542
|
+
/**
|
|
543
|
+
* Fresh paths for one launch's plan (beside the preload, in the run's private directory)
|
|
544
|
+
* and record: no launch ever follows another's plan or reads another's record.
|
|
545
|
+
*/
|
|
546
|
+
private launchFiles;
|
|
547
|
+
/** Remove a launch's plan and record, and the record's temporary file (see writePrivateFileAtomically in preload-logic.ts), however the launch ended. */
|
|
548
|
+
private removeLaunchFiles;
|
|
549
|
+
/**
|
|
550
|
+
* Write `plan` to `planFile`, for the next child of the dry run; without a preload
|
|
551
|
+
* (init() never ran, so no plan path) there is nothing to give it to. A plan that cannot
|
|
552
|
+
* be written is an Error.
|
|
553
|
+
*/
|
|
554
|
+
private writePlan;
|
|
555
|
+
/** Read a launch's record and remove its file. */
|
|
556
|
+
private readRecord;
|
|
557
|
+
/** What the rules need to know about a published launch. */
|
|
558
|
+
private launchFacts;
|
|
559
|
+
/** M-eager: warn about each import of the eager loop that threw (the first ten; the rest at debug). */
|
|
560
|
+
private warnEagerFailures;
|
|
561
|
+
/**
|
|
562
|
+
* `full` (step 3, after `full` only 3c and 3d apply): one run with E imported first. A
|
|
563
|
+
* run that is not green goes to discovery when the test files name files in a literal
|
|
564
|
+
* `import()` or `require()` (one of those may be an entry point that breaks the run), and
|
|
565
|
+
* is otherwise returned as earlier versions returned it.
|
|
566
|
+
*/
|
|
567
|
+
private runFullShape;
|
|
568
|
+
/**
|
|
569
|
+
* `static` (step 3): one run with the scan's list imported first and the rest watched, judged by {@link oneRunOutcome}.
|
|
570
|
+
*
|
|
571
|
+
* @param roots - The scan's roots: a test file that ran and is not among them was never read by the scan
|
|
572
|
+
*/
|
|
573
|
+
private runStaticShape;
|
|
574
|
+
/**
|
|
575
|
+
* The two-run path (step 4): a plain run of the tests is observed, and the run that
|
|
576
|
+
* publishes imports what it was seen to load (with K); then the rules of section 3.
|
|
577
|
+
* After a failed first run with named files (step 3c), a plain run that is not accepted
|
|
578
|
+
* hands back that first run's own result instead of an Error.
|
|
579
|
+
*/
|
|
580
|
+
private runTwoRuns;
|
|
581
|
+
/** The published run of the two-run path, judged by {@link twoRunOutcome} (rule 3.5). */
|
|
582
|
+
private runAfterDiscovery;
|
|
583
|
+
/** The messages of a two-run publication: M-G3a, M1 (when something is left out) and, after step 3c, M-named. */
|
|
584
|
+
private reportTwoRunPublication;
|
|
585
|
+
/**
|
|
586
|
+
* Launch the discovery run (the design's section 2.2): the published run's `bun test`
|
|
587
|
+
* command line, bunfig and preloads, without the inspector and the sync server, nothing
|
|
588
|
+
* imported first, the sensors watching E, bounded by bun.timeout; and judge it with
|
|
589
|
+
* {@link acceptDiscovery}.
|
|
590
|
+
*/
|
|
591
|
+
private runDiscovery;
|
|
592
|
+
/** M-refuse: the load sensors cannot be trusted. Nothing is persisted. */
|
|
593
|
+
private refuseDryRun;
|
|
594
|
+
/**
|
|
595
|
+
* M-P1: the plain run of the tests was not accepted. The message carries bun's own
|
|
596
|
+
* output through the diagnostics the completeness error uses: the "Unhandled error
|
|
597
|
+
* between tests" blocks, else the tail of the output, and the line about
|
|
598
|
+
* bun.dryRunOutputFile.
|
|
599
|
+
*/
|
|
600
|
+
private discoveryError;
|
|
601
|
+
/** M-G3b: candidates the plain run did not load were loaded after the published run's imports. */
|
|
602
|
+
private lateLoadError;
|
|
603
|
+
/**
|
|
604
|
+
* M-lost: mutant ids the plain run reached and the published run did not; their files are read from the instrumented sources.
|
|
605
|
+
*
|
|
606
|
+
* @param always - How many files of `list` only bun.alwaysImport kept
|
|
607
|
+
*/
|
|
608
|
+
private lostError;
|
|
609
|
+
/**
|
|
610
|
+
* Hand Stryker a published run's result: persist the registry (for a green run with the
|
|
611
|
+
* timeout correction and the campaign: a new generation, the watch list W of the files E
|
|
612
|
+
* outside L and `seen`) and give the warnings of a completed run, then return it. Only
|
|
613
|
+
* a Complete result has anything to persist; any other is returned as it is. A run whose
|
|
614
|
+
* watch list cannot be published with its registry is an Error instead.
|
|
615
|
+
*
|
|
616
|
+
* @param seen - Files of E outside L the run's sensors saw (and so loaded): not watched; none by default
|
|
617
|
+
*/
|
|
618
|
+
private publishDryRun;
|
|
619
|
+
/**
|
|
620
|
+
* Earlier versions' inspected dry run, once: the sync server, the `bun test` child with
|
|
621
|
+
* the inspector, the completeness gate and the mapper. It writes nothing that outlives
|
|
622
|
+
* it: the result comes back with what persisting it needs (see {@link publishDryRun}).
|
|
623
|
+
*/
|
|
624
|
+
private runInspectedPass;
|
|
625
|
+
/**
|
|
626
|
+
* {@link runInspectedPass} with its coverage file: everything from the sync server to the result.
|
|
627
|
+
*
|
|
628
|
+
* @param launched - Where it puts the child's promise once the child is started
|
|
629
|
+
*/
|
|
630
|
+
private runInspectedChild;
|
|
450
631
|
/**
|
|
451
632
|
* The dry run's coverageAnalysis: Stryker's DryRunOptions value, else the
|
|
452
633
|
* Stryker options' value. Extracted to keep dryRun()'s complexity under the
|
|
@@ -461,14 +642,13 @@ export declare class BunTestRunner implements TestRunner {
|
|
|
461
642
|
private warnOnAbnormalDrainData;
|
|
462
643
|
/**
|
|
463
644
|
* Post-child-exit dry-run pipeline: collect/remap coverage, build tests
|
|
464
|
-
* from inspector data, sort them for incremental-mode determinism, run
|
|
465
|
-
* completeness gate
|
|
466
|
-
*
|
|
467
|
-
*
|
|
645
|
+
* from inspector data, sort them for incremental-mode determinism, and run
|
|
646
|
+
* the completeness gate. Returns the gate's Error result when it fires,
|
|
647
|
+
* otherwise the Complete result with what persisting it needs: the registry
|
|
648
|
+
* is written only once the dry run's rules pass (see publishDryRun).
|
|
468
649
|
*
|
|
469
|
-
* Extracted from
|
|
470
|
-
* complexity under the lint threshold
|
|
471
|
-
* order and same early-return-on-gate-failure semantics as before.
|
|
650
|
+
* Extracted from runInspectedPass() purely to keep its own cyclomatic
|
|
651
|
+
* complexity under the lint threshold.
|
|
472
652
|
*/
|
|
473
653
|
private buildGatedDryRunResult;
|
|
474
654
|
/**
|
|
@@ -517,8 +697,41 @@ export declare class BunTestRunner implements TestRunner {
|
|
|
517
697
|
*
|
|
518
698
|
* Writing to a .tmp path then renaming is atomic on POSIX: readers always see
|
|
519
699
|
* either the previous complete file or the new one — never a partial write.
|
|
700
|
+
*
|
|
701
|
+
* With `campaignInput` (a green run) the registry also starts the campaign (see
|
|
702
|
+
* src/coverage/dry-run-files.ts): a new generation, which makes every abort marker of
|
|
703
|
+
* an earlier one stale (the stale marker is removed once the registry is in place),
|
|
704
|
+
* and, when the list was shortened, the watch list W the mutant runs' witness reads,
|
|
705
|
+
* written under the generation's own name before the registry that names it is
|
|
706
|
+
* renamed into place, last. And it carries the timeout correction every worker's
|
|
707
|
+
* mutant runs apply. Without it (a run with failing tests) the registry is the one
|
|
708
|
+
* earlier versions wrote.
|
|
709
|
+
*
|
|
710
|
+
* A registry that cannot be written is only warned about, as in earlier versions,
|
|
711
|
+
* unless the campaign has a watch list: its mutant runs would then not watch what the
|
|
712
|
+
* dry run left out, so the failure is returned, as the dry run's Error message.
|
|
713
|
+
*
|
|
714
|
+
* @returns Undefined, or the Error message when a campaign with a watch list could not be published
|
|
520
715
|
*/
|
|
521
716
|
private buildAndPersistTestRegistry;
|
|
717
|
+
/**
|
|
718
|
+
* A registry write failed: the dry run's Error message (M-publish) when the campaign has a
|
|
719
|
+
* watch list, naming the file that could not be written; otherwise a warning, as in
|
|
720
|
+
* earlier versions (the worker that ran the dry run still has its in-memory copy; other
|
|
721
|
+
* workers fall back to raw names and log a warning), and undefined.
|
|
722
|
+
*/
|
|
723
|
+
private registryWriteFailed;
|
|
724
|
+
/**
|
|
725
|
+
* {@link buildAndPersistTestRegistry}'s writes: the campaign's watch list (when it has one),
|
|
726
|
+
* then the registry, renamed into place last, then the stale marker's removal. A write that
|
|
727
|
+
* fails is a {@link WriteFailure} naming its file; a watch list no registry names is removed.
|
|
728
|
+
*/
|
|
729
|
+
private writeRegistry;
|
|
730
|
+
/**
|
|
731
|
+
* A new campaign's state for the registry: a new generation, W, and (inPlace only) the
|
|
732
|
+
* fingerprint of E; W is written first, under the generation's own name.
|
|
733
|
+
*/
|
|
734
|
+
private writeCampaignFiles;
|
|
522
735
|
/**
|
|
523
736
|
* Warn that the dry-run registry could not be written. The registry also carries
|
|
524
737
|
* Stryker's testFiles selection, so when one is active the warning adds that other
|
|
@@ -540,6 +753,27 @@ export declare class BunTestRunner implements TestRunner {
|
|
|
540
753
|
*/
|
|
541
754
|
mutantRun(options: MutantRunOptions): Promise<MutantRunResult>;
|
|
542
755
|
/**
|
|
756
|
+
* Stryker's per-mutant timeout less the dry run's correction (rule 3.6), once, before the
|
|
757
|
+
* runner's own margin: Stryker sizes the timeout from the dry run's overhead, which the
|
|
758
|
+
* import scan, a discarded run and a discovery run would otherwise lengthen. A missing or
|
|
759
|
+
* unusable correction leaves Stryker's value as it is, and says so once at debug.
|
|
760
|
+
*/
|
|
761
|
+
private correctedStrykerTimeout;
|
|
762
|
+
/** The watch list every mutant run's child gets: the campaign's, when it watches anything. */
|
|
763
|
+
private watchListForMutantRuns;
|
|
764
|
+
/**
|
|
765
|
+
* The witness's verdict on a mutant run's child, which comes before the child's own
|
|
766
|
+
* (Killed, Survived, Timeout): a valid line, signed with this spawn's token and naming
|
|
767
|
+
* only files of W, means a watched file was in bun's module cache when the mutant first
|
|
768
|
+
* executed. The worker then writes the abort marker for its campaign and rejects the
|
|
769
|
+
* mutant run with M-witness; Stryker's recovery init() then rejects too (see
|
|
770
|
+
* rejectIfCampaignStopped), which ends the campaign. An unusable watch list the child
|
|
771
|
+
* reported is warned about once, and the run's own verdict stands.
|
|
772
|
+
*/
|
|
773
|
+
private enforceWitness;
|
|
774
|
+
/** The tests a mutant run selected, in M-witness's words, and the covering tests it lists when it ran those (the rest of a long list goes to debug). */
|
|
775
|
+
private witnessScope;
|
|
776
|
+
/**
|
|
543
777
|
* Recognise a testFilter that is a list of test FILES rather than test ids.
|
|
544
778
|
*
|
|
545
779
|
* Stryker core's own `testFiles` option (9.6+, also 10) makes the mutant
|
|
@@ -672,6 +906,8 @@ export declare class BunTestRunner implements TestRunner {
|
|
|
672
906
|
/**
|
|
673
907
|
* Check for dry run process failures (timeout or non-zero exit).
|
|
674
908
|
* Returns a DryRunResult to short-circuit if the process failed, or null to proceed.
|
|
909
|
+
* The child's stderr goes into the message as the diagnostics show it ({@link cleanDiagnosticText}):
|
|
910
|
+
* it can carry an inspector address, the run's secrets, or an import error that holds either.
|
|
675
911
|
*/
|
|
676
912
|
private checkDryRunProcessResult;
|
|
677
913
|
/**
|
|
@@ -704,6 +940,17 @@ export declare class BunTestRunner implements TestRunner {
|
|
|
704
940
|
*/
|
|
705
941
|
private warnOnUnidentifiedDryRunFailure;
|
|
706
942
|
/**
|
|
943
|
+
* The last line of a completeness error, about bun's complete output: without a bun.dryRunOutputFile
|
|
944
|
+
* option, which option to set; with one, the file it was written to (absolute, control characters
|
|
945
|
+
* escaped) or in one line why it could not be written (see src/utils/dry-run-output-log.ts). The file
|
|
946
|
+
* is resolved against the directory Stryker was started in (src/utils/project-dir.ts), and the child's
|
|
947
|
+
* working directory is the one captured at spawn: the sandbox may be gone by now.
|
|
948
|
+
*
|
|
949
|
+
* Never throws or rejects, whatever fails inside it: it is optional, and must not hide or replace the
|
|
950
|
+
* completeness error it accompanies.
|
|
951
|
+
*/
|
|
952
|
+
private saveFailedDryRunOutput;
|
|
953
|
+
/**
|
|
707
954
|
* Dry-run data-completeness gate.
|
|
708
955
|
*
|
|
709
956
|
* A dry run may only be reported Complete when every test bun ran, and every
|
|
@@ -729,9 +976,20 @@ export declare class BunTestRunner implements TestRunner {
|
|
|
729
976
|
* a few ms after the drain acknowledgment on healthy runs. It is added to the
|
|
730
977
|
* message only as context once the gate has already fired.
|
|
731
978
|
*
|
|
732
|
-
*
|
|
979
|
+
* Computed once, here: the reasons the gate fails the run (empty when it does not), so that
|
|
980
|
+
* the caller saves bun's output and builds the message ({@link completenessError}) only
|
|
981
|
+
* for a run that fails, and a healthy one pays nothing for either.
|
|
982
|
+
*
|
|
983
|
+
* @returns The reasons the dry run fails, one sentence each; none when it does not.
|
|
984
|
+
*/
|
|
985
|
+
private findCompletenessProblems;
|
|
986
|
+
/**
|
|
987
|
+
* The Error result for a failed completeness gate: `reasons` (from {@link findCompletenessProblems}), the
|
|
988
|
+
* inspector's unexpected close as context, the advice, and last, on a line of its own, `outputLine`
|
|
989
|
+
* (where bun's complete output was saved, or why it was not, or which option saves it). Logged
|
|
990
|
+
* through logger.error as well.
|
|
733
991
|
*/
|
|
734
|
-
private
|
|
992
|
+
private completenessError;
|
|
735
993
|
/**
|
|
736
994
|
* Collect coverage from the coverage file and remap counter-based IDs to
|
|
737
995
|
* full test names using the inspector's execution order.
|
|
@@ -997,6 +1255,58 @@ export interface BunTestRunnerOptions {
|
|
|
997
1255
|
* @default 1
|
|
998
1256
|
*/
|
|
999
1257
|
maxSpawnDepth?: number;
|
|
1258
|
+
/**
|
|
1259
|
+
* A file to write the dry run's complete `bun test` output (stdout and stderr) to
|
|
1260
|
+
* when the dry run's data-completeness check fails. Without it nothing is written,
|
|
1261
|
+
* and the error message ends with a line saying to set this option and run again.
|
|
1262
|
+
*
|
|
1263
|
+
* A relative path resolves against the directory Stryker was started in (your
|
|
1264
|
+
* project), not against Stryker's sandbox copy, which is deleted when the run ends;
|
|
1265
|
+
* `inPlace` makes no difference. Missing parent directories are created, and a
|
|
1266
|
+
* symbolic link in a parent directory is followed. Each failure replaces the file
|
|
1267
|
+
* atomically (a new file beside it, mode 0600, renamed over it: an old file is never
|
|
1268
|
+
* truncated in place, and a hard link to it keeps the old content; with several workers
|
|
1269
|
+
* or runs, the last rename wins). A symbolic link, a directory or any other
|
|
1270
|
+
* non-regular file at the path itself is refused. Saving is given a few seconds (5);
|
|
1271
|
+
* if it takes longer the error is reported without it, and says so.
|
|
1272
|
+
*
|
|
1273
|
+
* Removed from the file: ANSI colour codes, the paths of inspector `ws://` addresses,
|
|
1274
|
+
* the fragment of `debug.bun.sh` links and this run's tokens. Everything else the
|
|
1275
|
+
* tests or the command line print, credentials included, is saved as printed:
|
|
1276
|
+
* check the file before sharing it or collecting it in CI. Each stream is kept
|
|
1277
|
+
* whole up to 16 Mi (16 777 216) characters; a longer one is cut in the middle,
|
|
1278
|
+
* and the file says so.
|
|
1279
|
+
*
|
|
1280
|
+
* @example 'reports/bun-dry-run-output.log'
|
|
1281
|
+
*/
|
|
1282
|
+
dryRunOutputFile?: string;
|
|
1283
|
+
/**
|
|
1284
|
+
* Files matched by `mutate` that the dry run imports before the tests even when
|
|
1285
|
+
* no test loads them, so that their module-level code runs before any test.
|
|
1286
|
+
*
|
|
1287
|
+
* `'all'` imports every file `mutate` matches, in one run of the tests. A list
|
|
1288
|
+
* holds glob patterns, matched against the project-relative paths of the files
|
|
1289
|
+
* `mutate` matches (dot directories and dot files included); nothing is globbed
|
|
1290
|
+
* again, so a pattern can only keep a file `mutate` already matched. A file is
|
|
1291
|
+
* kept when any pattern matches it. Negated patterns (`!…`) are not supported. A
|
|
1292
|
+
* pattern that matches none of those files is reported at warn.
|
|
1293
|
+
*
|
|
1294
|
+
* @example ['src/plugins/**', 'src/register.ts']
|
|
1295
|
+
*/
|
|
1296
|
+
alwaysImport?: "all" | string[];
|
|
1297
|
+
/**
|
|
1298
|
+
* How the dry run establishes which mutated files the tests load.
|
|
1299
|
+
*
|
|
1300
|
+
* - `'scan'`: the runner reads the imports of the test files and the preloads.
|
|
1301
|
+
* When that settles the question, the tests run once; when project code could
|
|
1302
|
+
* load a mutated file in a way the reading cannot settle, a plain run of the
|
|
1303
|
+
* tests is observed first.
|
|
1304
|
+
* - `'run'`: a plain run of the tests is always observed first, unless the files
|
|
1305
|
+
* the tests import (with `alwaysImport`) already cover every mutated file.
|
|
1306
|
+
*
|
|
1307
|
+
* @default 'scan'
|
|
1308
|
+
*/
|
|
1309
|
+
importDiscovery?: "scan" | "run";
|
|
1000
1310
|
}
|
|
1001
1311
|
/**
|
|
1002
1312
|
* Extended Stryker options with Bun-specific configuration
|
|
@@ -1086,6 +1396,33 @@ export declare const strykerValidationSchema: {
|
|
|
1086
1396
|
description: string;
|
|
1087
1397
|
default: number;
|
|
1088
1398
|
};
|
|
1399
|
+
dryRunOutputFile: {
|
|
1400
|
+
type: string;
|
|
1401
|
+
minLength: number;
|
|
1402
|
+
description: string;
|
|
1403
|
+
};
|
|
1404
|
+
alwaysImport: {
|
|
1405
|
+
description: string;
|
|
1406
|
+
oneOf: ({
|
|
1407
|
+
type: string;
|
|
1408
|
+
enum: string[];
|
|
1409
|
+
items?: undefined;
|
|
1410
|
+
} | {
|
|
1411
|
+
type: string;
|
|
1412
|
+
items: {
|
|
1413
|
+
type: string;
|
|
1414
|
+
minLength: number;
|
|
1415
|
+
pattern: string;
|
|
1416
|
+
};
|
|
1417
|
+
enum?: undefined;
|
|
1418
|
+
})[];
|
|
1419
|
+
};
|
|
1420
|
+
importDiscovery: {
|
|
1421
|
+
type: string;
|
|
1422
|
+
enum: string[];
|
|
1423
|
+
description: string;
|
|
1424
|
+
default: string;
|
|
1425
|
+
};
|
|
1089
1426
|
};
|
|
1090
1427
|
additionalProperties: boolean;
|
|
1091
1428
|
};
|