supercov 0.0.34 → 0.0.35

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "supercov",
3
- "version": "0.0.34",
3
+ "version": "0.0.35",
4
4
  "description": "Zero-edit, runner-aware coverage completeness for JavaScript, TypeScript, Rust, and Python test suites",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -73,12 +73,12 @@
73
73
  "test:ruby-coverage": "cargo build -p supercov && node scripts/ruby-coverage-integration.mjs"
74
74
  },
75
75
  "optionalDependencies": {
76
- "@supercov/cli-darwin-arm64": "0.0.34",
77
- "@supercov/cli-darwin-x64": "0.0.34",
78
- "@supercov/cli-linux-arm64-gnu": "0.0.34",
79
- "@supercov/cli-linux-arm64-musl": "0.0.34",
80
- "@supercov/cli-linux-x64-gnu": "0.0.34",
81
- "@supercov/cli-linux-x64-musl": "0.0.34"
76
+ "@supercov/cli-darwin-arm64": "0.0.35",
77
+ "@supercov/cli-darwin-x64": "0.0.35",
78
+ "@supercov/cli-linux-arm64-gnu": "0.0.35",
79
+ "@supercov/cli-linux-arm64-musl": "0.0.35",
80
+ "@supercov/cli-linux-x64-gnu": "0.0.35",
81
+ "@supercov/cli-linux-x64-musl": "0.0.35"
82
82
  },
83
83
  "peerDependencies": {
84
84
  "@playwright/test": ">=1.55.0",
@@ -480,12 +480,59 @@ function appendDurableBackgroundRecord(fs, runId, record) {
480
480
  return path;
481
481
  }
482
482
  var _a7;
483
+ // Evidence buffered for the current turn is lost when a signal ends the
484
+ // process, because "exit" does not run for one -- and killing a child in
485
+ // teardown is exactly how a suite stops a gateway it started. Flush on the
486
+ // terminating signals as well as on exit.
487
+ //
488
+ // Exactly one listener per signal serves every flusher: two of our own would
489
+ // each see a sibling listener, neither would judge itself alone, and a
490
+ // signalled process would stay alive. Having flushed, restore what the signal
491
+ // would have done -- if nothing else is listening the program expected to die,
492
+ // so re-raise with our listener gone; if the program installed its own handler
493
+ // it deliberately suppressed that default and we must not exit on its behalf.
494
+ function flushOnTermination(flush) {
495
+ var _a9;
496
+ if (typeof process === "undefined")
497
+ return;
498
+ const flushers = (_a9 = runtimeGlobal.__SUPERCOV_TERMINATION_FLUSHERS__) != null ? _a9 : /* @__PURE__ */ new Set();
499
+ runtimeGlobal.__SUPERCOV_TERMINATION_FLUSHERS__ = flushers;
500
+ flushers.add(flush);
501
+ if (runtimeGlobal.__SUPERCOV_TERMINATION_INSTALLED__)
502
+ return;
503
+ runtimeGlobal.__SUPERCOV_TERMINATION_INSTALLED__ = true;
504
+ const drain = () => {
505
+ var _a10;
506
+ for (const value of (_a10 = runtimeGlobal.__SUPERCOV_TERMINATION_FLUSHERS__) != null ? _a10 : []) {
507
+ try {
508
+ value();
509
+ } catch (e) {
510
+ }
511
+ }
512
+ };
513
+ try {
514
+ process.on("exit", drain);
515
+ } catch (e) {
516
+ }
517
+ for (const signal of ["SIGTERM", "SIGINT", "SIGHUP", "SIGBREAK"]) {
518
+ try {
519
+ process.on(signal, () => {
520
+ drain();
521
+ if (process.listenerCount(signal) <= 1) {
522
+ process.removeAllListeners(signal);
523
+ process.kill(process.pid, signal);
524
+ }
525
+ });
526
+ } catch (e) {
527
+ }
528
+ }
529
+ }
483
530
  if (!isBrowser) {
484
531
  const flushers = (_a7 = runtimeGlobal.__SUPERCOV_BUFFER_FLUSHERS__) != null ? _a7 : /* @__PURE__ */ new Set();
485
532
  runtimeGlobal.__SUPERCOV_BUFFER_FLUSHERS__ = flushers;
486
533
  flushers.add(flushAllBufferedServerEvidence);
487
534
  if (!runtimeGlobal.__SUPERCOV_BUFFER_EXIT_INSTALLED__) {
488
- process.once("exit", () => {
535
+ flushOnTermination(() => {
489
536
  var _a8;
490
537
  for (const flush of (_a8 = runtimeGlobal.__SUPERCOV_BUFFER_FLUSHERS__) != null ? _a8 : [])
491
538
  flush();
@@ -538,7 +585,7 @@ function enqueueServerAppend(directory, path, line, runId) {
538
585
  if (!state.serverExitHookInstalled && typeof process !== "undefined") {
539
586
  state.serverExitHookInstalled = true;
540
587
  try {
541
- process.on("exit", flushServerAppends);
588
+ flushOnTermination(flushServerAppends);
542
589
  } catch (e) {
543
590
  }
544
591
  }
@@ -1238,6 +1285,7 @@ export {
1238
1285
  enableRuntimeSnapshotEvidence,
1239
1286
  flushBufferedBackgroundEvidence,
1240
1287
  flushBufferedServerEvidence,
1288
+ flushOnTermination,
1241
1289
  loopBegin,
1242
1290
  loopEnd,
1243
1291
  loopEntered,