@hughescr/stryker-bun-runner 1.7.0 → 1.7.2
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 +25 -2
- package/dist/index.d.ts +21 -2
- package/dist/index.js +1247 -1008
- package/dist/templates/coverage-preload.js +6 -2
- package/dist/templates/import-scan.js +11 -4
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -219,6 +219,18 @@ What can change after you upgrade:
|
|
|
219
219
|
earlier speed, set `'perTest'` (or remove the setting: it is Stryker's default). With
|
|
220
220
|
`incremental`, run once with `--force` after upgrading; after that, see
|
|
221
221
|
[coverageAnalysis](#coverageanalysis) for when to use it again.
|
|
222
|
+
- **`.jsx`, `.mts` and `.cts` files are mutated files like the others**
|
|
223
|
+
([#4](https://github.com/hughescr/stryker-bun-runner/issues/4)). Before, the runner left them out
|
|
224
|
+
of its own list of the files that `mutate` matches, though Stryker mutated them: it never
|
|
225
|
+
imported them before the tests, `bun.alwaysImport` could not name them (and warned that the
|
|
226
|
+
pattern matched none of the files), and nothing named them when no test loaded them. Now the
|
|
227
|
+
module-level code of such a file that your tests load runs before the tests, so results in it
|
|
228
|
+
can change, as for the other files. With `incremental`, run once with `--force` after upgrading.
|
|
229
|
+
- **A file you select as a test is never imported before the tests**, though its name has no test
|
|
230
|
+
suffix and `mutate` matches it (`src/checks.mts` in `bun.testFiles`, say). Before, the runner
|
|
231
|
+
imported it like a source file, and the dry run failed with bun's `Cannot use test during
|
|
232
|
+
preload`. If `bun.alwaysImport` names such a file, it is still not imported, and the runner warns
|
|
233
|
+
about the pattern.
|
|
222
234
|
|
|
223
235
|
## Upgrading from 1.5
|
|
224
236
|
|
|
@@ -313,7 +325,9 @@ Most projects need no config change, but these differ from 1.4:
|
|
|
313
325
|
- **Inspector**: Bun's debugging protocol. The runner uses its test events to see each test start
|
|
314
326
|
and finish.
|
|
315
327
|
- **Drain handshake**: at the end of the dry run, the test process waits until the runner confirms
|
|
316
|
-
it has received
|
|
328
|
+
it has received the test events, so none are lost on a busy machine. When the runner cannot
|
|
329
|
+
confirm it, the dry run warns, and it is refused if any test result or any test's coverage could
|
|
330
|
+
be missing or credited to the wrong test; it does not promise that every inspector event arrived.
|
|
317
331
|
- **Plain run**: a run of your tests that the dry run sometimes makes first, with no mutated file
|
|
318
332
|
imported before the tests, only to see which mutated files the tests load. Its results are not
|
|
319
333
|
reported to Stryker ([when it happens](#if-the-dry-run-runs-your-tests-twice)).
|
|
@@ -488,6 +502,13 @@ its mutants are [static mutants](#terms), the same on every run. It does not imp
|
|
|
488
502
|
test loads, and a mutant there that no test reaches is NoCoverage. That way a file that fails when
|
|
489
503
|
it is imported on its own, such as an app's entry point, does not break the dry run.
|
|
490
504
|
|
|
505
|
+
The mutated files here are the JavaScript and TypeScript files that `mutate` matches (`.js`,
|
|
506
|
+
`.jsx`, `.mjs`, `.cjs`, `.ts`, `.tsx`, `.mts` and `.cts`), other than declaration files (`.d.ts`,
|
|
507
|
+
`.d.mts`, `.d.cts`) and test files: files whose names end in a test suffix (such as `.test.ts`,
|
|
508
|
+
`_test.mts` or `.spec.jsx`, in any case), and files you select as tests (in `bun.testFiles` or
|
|
509
|
+
Stryker's `testFiles`) whatever their names. A test file is never imported before the tests, even
|
|
510
|
+
when `bun.alwaysImport` names it; the runner warns about a pattern that names only such files.
|
|
511
|
+
|
|
491
512
|
To find the files, the runner reads the import statements of your test files and preloads
|
|
492
513
|
(`[test].preload` in your bunfig, and `--preload` in `bun.bunArgs`), with a short `bun` process
|
|
493
514
|
that runs none of your code. Then:
|
|
@@ -1142,7 +1163,9 @@ also fails; see [Inspector diagnostics](docs/internals.md#inspector-diagnostics)
|
|
|
1142
1163
|
[`ignoreStatic`](#ignorestatic-faster-but-skips-module-level-code).
|
|
1143
1164
|
- **`bun.maxChildRss` is a polled, soft limit**, not a kernel-enforced one.
|
|
1144
1165
|
- **The dry run's fixed bounds** (the 30 s drain handshake ceiling, the 4 s silence limit) have no
|
|
1145
|
-
options.
|
|
1166
|
+
options. With `--isolate`, a test file that has no tests, or in which `.only` leaves some tests
|
|
1167
|
+
out, adds up to 4 s to the dry run, and so does every test file bun runs after it: nothing else
|
|
1168
|
+
can show the runner that it has every test event from those files.
|
|
1146
1169
|
|
|
1147
1170
|
## Advanced topics
|
|
1148
1171
|
|
package/dist/index.d.ts
CHANGED
|
@@ -145,6 +145,12 @@ export declare class BunTestRunner implements TestRunner {
|
|
|
145
145
|
* "Orphan prevention" in docs/internals.md.
|
|
146
146
|
*/
|
|
147
147
|
private currentAbortController?;
|
|
148
|
+
/**
|
|
149
|
+
* The drain handshake's silence bound (see src/drain-handshake.ts). Not an
|
|
150
|
+
* option: a subclass in tests/00-integration/isolate-integration.test.ts
|
|
151
|
+
* shortens it, to make a real bun child's fallback wait short.
|
|
152
|
+
*/
|
|
153
|
+
protected readonly drainSilenceMs: number;
|
|
148
154
|
constructor(logger: Logger, options: StrykerOptions);
|
|
149
155
|
/**
|
|
150
156
|
* Single source of truth for the registry file name.
|
|
@@ -526,7 +532,19 @@ export declare class BunTestRunner implements TestRunner {
|
|
|
526
532
|
private runWithoutCoverage;
|
|
527
533
|
/** One info line naming bun.alwaysImport and bun.importDiscovery, when set: with coverageAnalysis 'off' neither has an effect. */
|
|
528
534
|
private noteOptionsWithoutEffect;
|
|
529
|
-
/**
|
|
535
|
+
/** The test files this dry run hands bun, and what they expand to: the import scan's roots, and the files E loses. */
|
|
536
|
+
private dryRunTestFiles;
|
|
537
|
+
/**
|
|
538
|
+
* E: the files matched by mutate less the ones this dry run runs as tests (see
|
|
539
|
+
* withoutSelectedTestFiles), which are said at debug. When an entry cannot be expanded
|
|
540
|
+
* (the scan then does not start), the entries themselves are taken: a directory adds only
|
|
541
|
+
* files with a test suffix, which E never holds.
|
|
542
|
+
*/
|
|
543
|
+
private withoutTestFilesRun;
|
|
544
|
+
/**
|
|
545
|
+
* K: the files of E that bun.alwaysImport keeps, with a warning for each pattern that keeps
|
|
546
|
+
* none: that it names only test files the dry run runs (`removed`), or that it matches nothing.
|
|
547
|
+
*/
|
|
530
548
|
private selectAlwaysImported;
|
|
531
549
|
/** `file` relative to the dry run's project directory, as the messages show it (quoted when it must be, see displayName). */
|
|
532
550
|
private projectPathsOf;
|
|
@@ -757,7 +775,8 @@ export declare class BunTestRunner implements TestRunner {
|
|
|
757
775
|
private writeRegistry;
|
|
758
776
|
/**
|
|
759
777
|
* A new campaign's state for the registry: a new generation, W, and (inPlace only) the
|
|
760
|
-
* fingerprint of
|
|
778
|
+
* fingerprint of every file matched by mutate (test files included, as init() computes
|
|
779
|
+
* it in rejectIfCampaignStopped); W is written first, under the generation's own name.
|
|
761
780
|
*/
|
|
762
781
|
private writeCampaignFiles;
|
|
763
782
|
/**
|