@systemfsoftware/stryker-js-vitest-runner 8.0.3 → 8.1.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/CHANGELOG.md CHANGED
@@ -1,5 +1,15 @@
1
1
  # @systemfsoftware/stryker-js-vitest-runner
2
2
 
3
+ ## 8.1.0
4
+
5
+ ### Minor Changes
6
+
7
+ - The Vitest runner persists transformed modules to a file-system cache under the sandbox and reuses them across the worker threads the standby pool hands out, so a mutant run that lands on a freshly handed-out thread reads the transforms it already paid for instead of recompiling every module. The cache can be turned off with `testRunner: { options: { fsModuleCache: false } }`. Verdicts are unchanged.
8
+
9
+ ### Patch Changes
10
+
11
+ - The runner no longer lets the ambient `VITEST_MAX_WORKERS` setting raise the number of Vitest workers it runs with, which could start a mutant's covering tests concurrently; with that setting in the environment, a previously recorded killer still runs first and a killed mutant stops at its killer.
12
+
3
13
  ## 8.0.3
4
14
 
5
15
  ### Patch Changes
package/dist/main.mjs CHANGED
@@ -53757,10 +53757,17 @@ const CheckerMutantWire = Struct({
53757
53757
  replacement: String$2,
53758
53758
  location: Location$1
53759
53759
  });
53760
- const CheckResultSchema = Union([Struct({ status: Literal("passed") }), Struct({
53761
- status: Literal("compileError"),
53762
- reason: String$2
53763
- })]).pipe(toTaggedUnion("status"));
53760
+ const CheckResultSchema = Union([
53761
+ Struct({ status: Literal("passed") }),
53762
+ Struct({
53763
+ status: Literal("compileError"),
53764
+ reason: String$2
53765
+ }),
53766
+ Struct({
53767
+ status: Literal("ignored"),
53768
+ reason: String$2
53769
+ })
53770
+ ]).pipe(toTaggedUnion("status"));
53764
53771
  Literals(CheckResultSchema.discriminants);
53765
53772
  var CheckerFailed = class extends TaggedError()("CheckerFailed", {
53766
53773
  cause: String$2,
@@ -54155,7 +54162,7 @@ const StrykerOptionsSchema = StructWithRest(Struct({
54155
54162
  dryRunOnly: defaulted(Boolean$3, false),
54156
54163
  ignorePatterns: defaulted(ArraySchema(String$2), []),
54157
54164
  ignoreStatic: defaulted(Boolean$3, false),
54158
- incremental: defaulted(Boolean$3, false),
54165
+ incremental: defaulted(Boolean$3, true),
54159
54166
  incrementalFile: defaulted(String$2, "reports/stryker-incremental.json"),
54160
54167
  incrementalSources: defaulted(ArraySchema(String$2), []),
54161
54168
  progressStreamFile: defaulted(String$2, "reports/mutation-stream.jsonl"),
@@ -55003,7 +55010,31 @@ const PluginLoadFailureReason = Union([
55003
55010
  TaggedStruct("InvalidContribution", { detail: String$2 }),
55004
55011
  TaggedStruct("ImportFailed", { cause: Unknown })
55005
55012
  ]);
55006
- const StreamSchemaVersion = Literal("2.0");
55013
+ const ShardPlanVersion = Literal(1);
55014
+ const Shard = Struct({
55015
+ index: Int,
55016
+ count: Int,
55017
+ predictedSeconds: Finite,
55018
+ projects: ArraySchema(Struct({
55019
+ project: String$2,
55020
+ mutants: ArraySchema(String$2)
55021
+ }))
55022
+ });
55023
+ const labelOf = (shard) => `${shard.index}/${shard.count}`;
55024
+ const shardLabelsAreUnique = makeFilter((shards) => {
55025
+ const duplicated = Mutant_exports.duplicatedValue(shards.map(labelOf));
55026
+ return duplicated === void 0 ? void 0 : `shard plan shards share the label "${duplicated}"`;
55027
+ }, { arbitraryConstraint: { uniqueBy: labelOf } });
55028
+ const ShardPlan = Struct({
55029
+ version: ShardPlanVersion,
55030
+ targetSeconds: Finite,
55031
+ shards: ArraySchema(Shard).check(shardLabelsAreUnique),
55032
+ matrix: Struct({ include: ArraySchema(Struct({
55033
+ shard: String$2,
55034
+ predictedSeconds: Finite
55035
+ })) })
55036
+ });
55037
+ const StreamSchemaVersion = Literal("6.0");
55007
55038
  const RunPhase = Literals([
55008
55039
  "prepare",
55009
55040
  "instrument",
@@ -55021,7 +55052,17 @@ var PhaseEntered = class extends TaggedClass()("phase", {
55021
55052
  phase: RunPhase,
55022
55053
  elapsedMs: Report_exports.NonNegativeFinite
55023
55054
  }) {};
55024
- var PlanKnown = class extends TaggedClass()("plan", { total: Report_exports.NonNegativeInt }) {};
55055
+ var PlanKnown = class extends TaggedClass()("plan", {
55056
+ total: Report_exports.NonNegativeInt,
55057
+ shardPlan: NullOr(ShardPlan)
55058
+ }) {};
55059
+ const WorkerRole = Literals(["testRunner", "checker"]);
55060
+ var WorkerReported = class extends TaggedClass()("worker", {
55061
+ schemaVersion: StreamSchemaVersion,
55062
+ role: WorkerRole,
55063
+ index: Report_exports.NonNegativeInt,
55064
+ startupMs: Report_exports.NonNegativeFinite
55065
+ }) {};
55025
55066
  const MutantCost = Struct({
55026
55067
  fixedOverheadMs: Report_exports.NonNegativeFinite,
55027
55068
  testBodyMs: Report_exports.NonNegativeFinite,
@@ -55108,6 +55149,7 @@ const VerdictMutant = Struct({
55108
55149
  });
55109
55150
  const RunScope = Literals(["full", "diff"]);
55110
55151
  const MutantSetPolicy = Literals(["default", "full"]);
55152
+ const IncrementalMode = Literals(["incremental", "full"]);
55111
55153
  const PhaseDurations = Struct({
55112
55154
  prepare: Report_exports.NonNegativeFinite,
55113
55155
  instrument: Report_exports.NonNegativeFinite,
@@ -55118,6 +55160,10 @@ const StaticVerdict = Struct({
55118
55160
  count: Report_exports.NonNegativeInt,
55119
55161
  costMs: Report_exports.NonNegativeFinite
55120
55162
  });
55163
+ const Budget = Struct({
55164
+ predictedSeconds: Report_exports.NonNegativeFinite,
55165
+ actualSeconds: Report_exports.NonNegativeFinite
55166
+ });
55121
55167
  var VerdictReached = class extends TaggedClass()("verdict", {
55122
55168
  schemaVersion: StreamSchemaVersion,
55123
55169
  runId: RunId,
@@ -55130,8 +55176,10 @@ var VerdictReached = class extends TaggedClass()("verdict", {
55130
55176
  mutants: ArraySchema(VerdictMutant),
55131
55177
  scope: RunScope,
55132
55178
  mutantSetPolicy: MutantSetPolicy,
55179
+ incrementalMode: optionalKey(IncrementalMode),
55133
55180
  phaseDurations: NullOr(PhaseDurations),
55134
- static: NullOr(StaticVerdict)
55181
+ static: NullOr(StaticVerdict),
55182
+ budget: Budget
55135
55183
  }) {};
55136
55184
  const FrameworkModuleRow = Struct({
55137
55185
  moduleName: String$2,
@@ -55177,6 +55225,10 @@ var ReuseReported = class extends TaggedClass()("reuse", {
55177
55225
  ran: Report_exports.NonNegativeInt,
55178
55226
  refused: ReuseRefusals
55179
55227
  }) {};
55228
+ var TceReported = class extends TaggedClass()("tce", {
55229
+ equivalentToOriginal: Report_exports.NonNegativeInt,
55230
+ duplicateAtSite: Report_exports.NonNegativeInt
55231
+ }) {};
55180
55232
  var MutantDetailReported = class extends TaggedClass()("mutant-detail", {
55181
55233
  id: Mutant_exports.MutantId,
55182
55234
  status: Mutant_exports.MutantStatusSchema,
@@ -55202,21 +55254,30 @@ var HelpRendered = class extends TaggedClass()("help", {
55202
55254
  code: Literals([0]),
55203
55255
  help: String$2
55204
55256
  }) {};
55257
+ const RefusalRule = Literal("mutation-runs-on-main-ci");
55258
+ var Refused = class extends TaggedClass()("refused", {
55259
+ schemaVersion: StreamSchemaVersion,
55260
+ rule: RefusalRule,
55261
+ message: String$2
55262
+ }) {};
55205
55263
  const RunEvent = Object.assign(Union([
55206
55264
  RunStarted,
55207
55265
  PhaseEntered,
55208
55266
  PlanKnown,
55267
+ WorkerReported,
55209
55268
  RunMutantTested,
55210
55269
  Heartbeat,
55211
55270
  PluginsReported,
55212
55271
  FormatRegistryResolved,
55213
55272
  SkippedReported,
55214
55273
  ReuseReported,
55274
+ TceReported,
55215
55275
  MutantDetailReported,
55216
55276
  FeedbackReported,
55217
55277
  VerdictReached,
55218
55278
  RunFailed,
55219
- HelpRendered
55279
+ HelpRendered,
55280
+ Refused
55220
55281
  ]), { QUEUE_BOUND: 256 });
55221
55282
  String$2.pipe(decodeTo(fromJsonString(RunEvent), {
55222
55283
  decode: transform$2((line) => line.replace(/\n$/, "")),
@@ -55467,74 +55528,6 @@ const Spans = {
55467
55528
  name: "stryker.load_config",
55468
55529
  attributes: {}
55469
55530
  },
55470
- mergeReports: {
55471
- name: "stryker.merge_reports",
55472
- attributes: {}
55473
- },
55474
- mergeReportsCollectPartDirs: {
55475
- name: "stryker.merge_reports.collect_part_dirs",
55476
- attributes: {}
55477
- },
55478
- mergeReportsDirectoryExists: {
55479
- name: "stryker.merge_reports.directory_exists",
55480
- attributes: {}
55481
- },
55482
- mergeReportsEncodeReport: {
55483
- name: "stryker.merge_reports.encode_report",
55484
- attributes: {}
55485
- },
55486
- mergeReportsFail: {
55487
- name: "stryker.merge_reports.fail",
55488
- attributes: {}
55489
- },
55490
- mergeReportsGather: {
55491
- name: "stryker.merge_reports.gather",
55492
- attributes: {}
55493
- },
55494
- mergeReportsListNames: {
55495
- name: "stryker.merge_reports.list_names",
55496
- attributes: {}
55497
- },
55498
- mergeReportsPutFile: {
55499
- name: "stryker.merge_reports.put_file",
55500
- attributes: {}
55501
- },
55502
- mergeReportsReadPart: {
55503
- name: "stryker.merge_reports.read_part",
55504
- attributes: {}
55505
- },
55506
- mergeReportsReadText: {
55507
- name: "stryker.merge_reports.read_text",
55508
- attributes: {}
55509
- },
55510
- mergeReportsRefuseCommand: {
55511
- name: "stryker.merge_reports.refuse_command",
55512
- attributes: {}
55513
- },
55514
- mergeReportsRefuseParts: {
55515
- name: "stryker.merge_reports.refuse_parts",
55516
- attributes: {}
55517
- },
55518
- mergeReportsRenderHtml: {
55519
- name: "stryker.merge_reports.render_html",
55520
- attributes: {}
55521
- },
55522
- mergeReportsWriteAbsent: {
55523
- name: "stryker.merge_reports.write_absent",
55524
- attributes: {}
55525
- },
55526
- mergeReportsWriteFiles: {
55527
- name: "stryker.merge_reports.write_files",
55528
- attributes: {}
55529
- },
55530
- mergeReportsWriteHtml: {
55531
- name: "stryker.merge_reports.write_html",
55532
- attributes: {}
55533
- },
55534
- mergeReportsWriteMerged: {
55535
- name: "stryker.merge_reports.write_merged",
55536
- attributes: {}
55537
- },
55538
55531
  mutantRun: {
55539
55532
  name: "stryker.mutant_run",
55540
55533
  attributes: {}
@@ -65306,6 +65299,7 @@ const VitestRunnerOptionsSchema = Struct({
65306
65299
  dir: optional(String$2),
65307
65300
  related: Boolean$3.pipe(withDecodingDefaultKey(succeed$2(true))),
65308
65301
  configFile: optional(String$2),
65302
+ fsModuleCache: optional(Boolean$3),
65309
65303
  pool: optional(VitestRunnerPool),
65310
65304
  timeoutTrapFile: optional(String$2),
65311
65305
  timeoutTrapMutantId: optional(Mutant_exports.MutantId)
@@ -65545,12 +65539,21 @@ const withApplicationSetup = (self, namespace) => {
65545
65539
  });
65546
65540
  return self;
65547
65541
  };
65548
- const make = (options) => withApplicationSetup(VitestRuntime.make({
65542
+ const SERIAL_WORKER_COUNT = 1;
65543
+ const pinSerialWorkerCount = (self) => {
65544
+ const driver = driverOf(self);
65545
+ driver.config.maxWorkers = SERIAL_WORKER_COUNT;
65546
+ driver.projects.forEach((project) => {
65547
+ project.config.maxWorkers = SERIAL_WORKER_COUNT;
65548
+ });
65549
+ return self;
65550
+ };
65551
+ const make = (options) => pinSerialWorkerCount(withApplicationSetup(VitestRuntime.make({
65549
65552
  projectRoot: options.projectRoot,
65550
65553
  localSetupFile: options.localSetupFile,
65551
65554
  mutantBail: options.mutantBail,
65552
65555
  globalTestInputs: globalTestInputsOf(options.driver, [options.localSetupFile])
65553
- }, options.driver), options.namespace);
65556
+ }, options.driver), options.namespace));
65554
65557
  const DRY_RUN_REPORTS_EVERY_FAILURE = 0;
65555
65558
  const workerBailFor = (self, mode) => mode === "dry-run" ? DRY_RUN_REPORTS_EVERY_FAILURE : self.mutantBail;
65556
65559
  const setMode = dual(2, (self, mode) => {
@@ -65703,6 +65706,11 @@ var TestFileOrderSequencer = class extends BaseSequencer {
65703
65706
  return published.order.length > 0 ? Promise.resolve([...orderSpecifications(files, orderedModuleIdsOf(published, files))]) : super.sort(files).then((base) => priorityOrdered(published, base));
65704
65707
  }
65705
65708
  };
65709
+ const moduleCacheEnabled = (input) => input.vitestOptions.fsModuleCache !== false;
65710
+ const moduleCacheConfig = (input) => moduleCacheEnabled(input) ? {
65711
+ fsModuleCache: true,
65712
+ fsModuleCachePath: input.projectRoot + "/.vitest-module-cache"
65713
+ } : void 0;
65706
65714
  const createVitestConfig = (input, standbyThreads) => ({
65707
65715
  config: input.vitestOptions.configFile,
65708
65716
  coverage: { enabled: false },
@@ -65719,6 +65727,10 @@ const createVitestConfig = (input, standbyThreads) => ({
65719
65727
  onNone: () => ({}),
65720
65728
  onSome: () => ({ pool: initializer(standbyThreads) })
65721
65729
  }),
65730
+ ...match$6(fromNullishOr(moduleCacheConfig(input)), {
65731
+ onNone: () => ({}),
65732
+ onSome: (cache) => cache
65733
+ }),
65722
65734
  bail: input.bail,
65723
65735
  onConsoleLog: () => false,
65724
65736
  silent: true,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@systemfsoftware/stryker-js-vitest-runner",
3
- "version": "8.0.3",
3
+ "version": "8.1.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/systemfsoftware/stryker-js-effect.git",
@@ -65,14 +65,15 @@
65
65
  "typescript": "^7",
66
66
  "vitest": "^5",
67
67
  "@systemfsoftware/stryker-config": "^0.1.0",
68
- "@systemfsoftware/stryker-js-cli-contract": "^0.2.0",
69
- "@systemfsoftware/stryker-js-instrumenter": "^12.0.0",
70
- "@systemfsoftware/stryker-js-plugin-interface": "^12.0.0",
71
- "@systemfsoftware/vitest-config": "^0.1.0",
68
+ "@systemfsoftware/stryker-js-instrumenter": "^12.1.0",
69
+ "@systemfsoftware/stryker-js-plugin-interface": "^13.0.0",
70
+ "@systemfsoftware/stryker-js-plugin-runtime": "^7.0.1",
72
71
  "@systemfsoftware/tsdown-config": "^0.1.0",
73
- "@systemfsoftware/stryker-js-plugin-runtime": "^7.0.0"
72
+ "@systemfsoftware/stryker-js-cli-contract": "^0.3.0",
73
+ "@systemfsoftware/vitest-config": "^0.1.0"
74
74
  },
75
75
  "publishConfig": {
76
+ "access": "public",
76
77
  "provenance": true
77
78
  },
78
79
  "inlinedDependencies": {