@hughescr/stryker-bun-runner 1.7.1 → 1.8.0
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 +339 -25
- package/dist/index.d.ts +77 -9
- package/dist/index.js +1766 -1146
- package/dist/templates/coverage-preload.js +6 -2
- package/dist/templates/import-scan.js +1644 -21
- package/package.json +25 -19
package/dist/index.d.ts
CHANGED
|
@@ -1,10 +1,18 @@
|
|
|
1
|
-
// Generated by dts-bundle-generator
|
|
1
|
+
// Generated by dts-bundle-generator v10.0.0
|
|
2
2
|
|
|
3
3
|
import { PartialStrykerOptions, StrykerOptions } from '@stryker-mutator/api/core';
|
|
4
4
|
import { Logger } from '@stryker-mutator/api/logging';
|
|
5
5
|
import { PluginKind } from '@stryker-mutator/api/plugin';
|
|
6
6
|
import { DryRunOptions, DryRunResult, MutantRunOptions, MutantRunResult, TestRunner, TestRunnerCapabilities } from '@stryker-mutator/api/test-runner';
|
|
7
7
|
|
|
8
|
+
interface HandOffBudget {
|
|
9
|
+
/** Wall time in milliseconds of all the hand-off work: reading hand-offs in the files the answer reads, the walk over H's closure, and reading the mutant ids of H's files. */
|
|
10
|
+
readonly wallMs: number;
|
|
11
|
+
/** How many files the walk over H's closure may visit. */
|
|
12
|
+
readonly files: number;
|
|
13
|
+
/** How many mutant ids H's files may hold in all. */
|
|
14
|
+
readonly ids: number;
|
|
15
|
+
}
|
|
8
16
|
/**
|
|
9
17
|
* Bun test runner for Stryker mutation testing
|
|
10
18
|
*/
|
|
@@ -65,6 +73,8 @@ export declare class BunTestRunner implements TestRunner {
|
|
|
65
73
|
private readonly dryRunOutputFile?;
|
|
66
74
|
/** Stryker's coverageAnalysis from the Stryker options; DryRunOptions.coverageAnalysis wins when given. */
|
|
67
75
|
private readonly coverageAnalysis?;
|
|
76
|
+
/** Stryker's ignoreStatic: whether the dry run credits each test with the handed mutants credited to every test (see creditHandedCoverage). */
|
|
77
|
+
private readonly ignoreStatic;
|
|
68
78
|
private preloadScriptPath?;
|
|
69
79
|
private coverageFilePath?;
|
|
70
80
|
private sanitizedBunfigPath?;
|
|
@@ -134,7 +144,11 @@ export declare class BunTestRunner implements TestRunner {
|
|
|
134
144
|
private timeoutCorrectionMs?;
|
|
135
145
|
/** True once the "no usable timeout correction" debug line has been logged; it is shown once per runner. */
|
|
136
146
|
private loggedUnusableCorrection;
|
|
137
|
-
/**
|
|
147
|
+
/**
|
|
148
|
+
* The campaign of this worker's dry run or of the registry, the run directory its files are
|
|
149
|
+
* in, and its watch list and the files whose mutants it credited for being handed to a worker
|
|
150
|
+
* or a child process as sets (built once, for every mutant run's witness check and hit limit).
|
|
151
|
+
*/
|
|
138
152
|
private campaign?;
|
|
139
153
|
/** True once a mutant run's unusable watch list has been warned about; it is shown once per runner. */
|
|
140
154
|
private warnedWatchListProblem;
|
|
@@ -145,6 +159,18 @@ export declare class BunTestRunner implements TestRunner {
|
|
|
145
159
|
* "Orphan prevention" in docs/internals.md.
|
|
146
160
|
*/
|
|
147
161
|
private currentAbortController?;
|
|
162
|
+
/**
|
|
163
|
+
* The drain handshake's silence bound (see src/drain-handshake.ts). Not an
|
|
164
|
+
* option: a subclass in tests/00-integration/isolate-integration.test.ts
|
|
165
|
+
* shortens it, to make a real bun child's fallback wait short.
|
|
166
|
+
*/
|
|
167
|
+
protected readonly drainSilenceMs: number;
|
|
168
|
+
/**
|
|
169
|
+
* The import scan's hand-off budget (see HAND_OFF_BUDGET in import-scan-runner.ts). Not an
|
|
170
|
+
* option: a subclass in tests/00-integration/worker-child-integration.test.ts shrinks it,
|
|
171
|
+
* so that a real helper goes over it without hundreds of megabytes of files.
|
|
172
|
+
*/
|
|
173
|
+
protected readonly handOffBudget: HandOffBudget;
|
|
148
174
|
constructor(logger: Logger, options: StrykerOptions);
|
|
149
175
|
/**
|
|
150
176
|
* Single source of truth for the registry file name.
|
|
@@ -542,6 +568,14 @@ export declare class BunTestRunner implements TestRunner {
|
|
|
542
568
|
private selectAlwaysImported;
|
|
543
569
|
/** `file` relative to the dry run's project directory, as the messages show it (quoted when it must be, see displayName). */
|
|
544
570
|
private projectPathsOf;
|
|
571
|
+
/**
|
|
572
|
+
* How publication credits the mutants of each file of H ({@link handedCredits}), from the published run's `tests`:
|
|
573
|
+
* which test belongs to which file is read from them, except with coverageAnalysis 'all' (where Stryker runs every
|
|
574
|
+
* test for any mutant reached); then, as for a file the scan names no launcher of, every test.
|
|
575
|
+
*/
|
|
576
|
+
private handedCreditsOf;
|
|
577
|
+
/** The files of H among `notLoaded` that hold a mutant id, by how publication credits them (M1 names them), as the messages show them. */
|
|
578
|
+
private handedSummary;
|
|
545
579
|
/** Log `message` at `level`, and at debug, for each list it shortened, the entries it left out (see listText). */
|
|
546
580
|
private logListed;
|
|
547
581
|
/**
|
|
@@ -644,9 +678,23 @@ export declare class BunTestRunner implements TestRunner {
|
|
|
644
678
|
* a Complete result has anything to persist; any other is returned as it is. A run whose
|
|
645
679
|
* watch list cannot be published with its registry is an Error instead.
|
|
646
680
|
*
|
|
681
|
+
* The mutants of the files of H, whether or not the run also loaded them in the test
|
|
682
|
+
* process, are credited to the tests of the test files that start them, or to every test
|
|
683
|
+
* ({@link handedCredits}, {@link creditHandedCoverage}), in the result handed to Stryker
|
|
684
|
+
* only, after every check; the files of H that hold an id are stored with the campaign,
|
|
685
|
+
* before the registry is written, for their mutants' runs, which have neither the witness
|
|
686
|
+
* nor a hit limit (see mutantRunGuards). Nothing after the registry is written depends on
|
|
687
|
+
* how many ids there are.
|
|
688
|
+
*
|
|
647
689
|
* @param seen - Files of E outside L the run's sensors saw (and so loaded): not watched; none by default
|
|
648
690
|
*/
|
|
649
691
|
private publishDryRun;
|
|
692
|
+
/**
|
|
693
|
+
* When the coverage exists but covers no mutant at all, every mutant will be NoCoverage
|
|
694
|
+
* (Stryker's executeNoCoverage): warn, since that is a legitimate outcome only when the
|
|
695
|
+
* tests really never touch the mutated files ('off' records no hit, so it is not judged).
|
|
696
|
+
*/
|
|
697
|
+
private warnIfNoMutantCovered;
|
|
650
698
|
/**
|
|
651
699
|
* Earlier versions' inspected dry run, once: the sync server, the `bun test` child with
|
|
652
700
|
* the inspector, the completeness gate and the mapper. It writes nothing that outlives
|
|
@@ -706,9 +754,10 @@ export declare class BunTestRunner implements TestRunner {
|
|
|
706
754
|
* and its failed-test report is the more useful message.
|
|
707
755
|
*
|
|
708
756
|
* When coverage exists but covers no mutant at all, every mutant will be
|
|
709
|
-
* NoCoverage (Stryker's executeNoCoverage) — warn
|
|
710
|
-
*
|
|
711
|
-
* no
|
|
757
|
+
* NoCoverage (Stryker's executeNoCoverage) — warn ({@link warnIfNoMutantCovered}).
|
|
758
|
+
* When a file of H holds a mutant id (`handedIdsHeld`), there is no warning:
|
|
759
|
+
* a coverage that covers nothing measures no id as static, so publication
|
|
760
|
+
* credits that id, and some mutant is covered.
|
|
712
761
|
*
|
|
713
762
|
* `[Stryker Coverage]` diagnostics from the preload are otherwise dropped on a
|
|
714
763
|
* green run (the child's stderr is only shown on failure), so they are
|
|
@@ -768,9 +817,11 @@ export declare class BunTestRunner implements TestRunner {
|
|
|
768
817
|
*/
|
|
769
818
|
private writeRegistry;
|
|
770
819
|
/**
|
|
771
|
-
* A new campaign's state for the registry: a new generation, W,
|
|
772
|
-
*
|
|
773
|
-
*
|
|
820
|
+
* A new campaign's state for the registry: a new generation, W, the files of H whose
|
|
821
|
+
* mutants publication credited for being handed to a worker or a child process, and
|
|
822
|
+
* (inPlace only) the fingerprint of every file matched by mutate (test files included,
|
|
823
|
+
* as init() computes it in rejectIfCampaignStopped); W is written first, under the
|
|
824
|
+
* generation's own name. The state goes into the registry, which is renamed into place.
|
|
774
825
|
*/
|
|
775
826
|
private writeCampaignFiles;
|
|
776
827
|
/**
|
|
@@ -800,6 +851,22 @@ export declare class BunTestRunner implements TestRunner {
|
|
|
800
851
|
* unusable correction leaves Stryker's value as it is, and says so once at debug.
|
|
801
852
|
*/
|
|
802
853
|
private correctedStrykerTimeout;
|
|
854
|
+
/**
|
|
855
|
+
* The file of the active mutant (Stryker's `sandboxFileName`, the file as E names it) when
|
|
856
|
+
* the campaign credited its mutants for being handed to a worker or a child process, to the
|
|
857
|
+
* tests that start it or to every test; undefined otherwise.
|
|
858
|
+
*/
|
|
859
|
+
private handedFileOf;
|
|
860
|
+
/**
|
|
861
|
+
* The hit limit and the watch list of a mutant run's child. A mutant of a file handed to a
|
|
862
|
+
* worker or a child process, however publication credited it, may run there first: what the
|
|
863
|
+
* tests load and execute in the test process afterwards (a fallback that imports a support
|
|
864
|
+
* file and the handed file, and runs its code many times) follows from the mutant. So its run
|
|
865
|
+
* has no witness, which looks only at the mutant's first execution in the test process, and
|
|
866
|
+
* no hit limit, which Stryker derived from hits that measured nothing of the worker or the
|
|
867
|
+
* child (see creditHandedCoverage); the run's timeout still applies. Every other run gets both.
|
|
868
|
+
*/
|
|
869
|
+
private mutantRunGuards;
|
|
803
870
|
/** The watch list every mutant run's child gets: the campaign's, when it watches anything. */
|
|
804
871
|
private watchListForMutantRuns;
|
|
805
872
|
/**
|
|
@@ -1164,7 +1231,8 @@ export interface TestFilesExcludedFromTypeCheckOptions {
|
|
|
1164
1231
|
* Logs one line per call: `console.info` on success, `console.warn` with the
|
|
1165
1232
|
* reason on every fallback. Returns `config` itself, writing nothing, when
|
|
1166
1233
|
* `checkers` does not include `typescript`, typescript cannot be loaded from
|
|
1167
|
-
* `cwd
|
|
1234
|
+
* `cwd` or exports no compiler API to read the tsconfig with (a shim, or TypeScript
|
|
1235
|
+
* 7 or later, which gets its own reason), the tsconfig is missing, has errors or uses project references,
|
|
1168
1236
|
* includes no test files, would be left with no files at all, leaving the tests
|
|
1169
1237
|
* out adds type errors, or the derived file cannot be written or belongs to
|
|
1170
1238
|
* somebody else (it has no generated header).
|