supercov 4.24.2 → 4.24.3

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": "4.24.2",
3
+ "version": "4.24.3",
4
4
  "description": "Coverage, security and code quality for coding agents",
5
5
  "keywords": [
6
6
  "coverage",
@@ -123,14 +123,14 @@
123
123
  "test:windows-tls": "node scripts/windows-tls-test.mjs"
124
124
  },
125
125
  "optionalDependencies": {
126
- "@supercov/cli-darwin-arm64": "4.24.2",
127
- "@supercov/cli-darwin-x64": "4.24.2",
128
- "@supercov/cli-linux-arm64-gnu": "4.24.2",
129
- "@supercov/cli-linux-arm64-musl": "4.24.2",
130
- "@supercov/cli-linux-x64-gnu": "4.24.2",
131
- "@supercov/cli-linux-x64-musl": "4.24.2",
132
- "@supercov/cli-win32-arm64": "4.24.2",
133
- "@supercov/cli-win32-x64": "4.24.2"
126
+ "@supercov/cli-darwin-arm64": "4.24.3",
127
+ "@supercov/cli-darwin-x64": "4.24.3",
128
+ "@supercov/cli-linux-arm64-gnu": "4.24.3",
129
+ "@supercov/cli-linux-arm64-musl": "4.24.3",
130
+ "@supercov/cli-linux-x64-gnu": "4.24.3",
131
+ "@supercov/cli-linux-x64-musl": "4.24.3",
132
+ "@supercov/cli-win32-arm64": "4.24.3",
133
+ "@supercov/cli-win32-x64": "4.24.3"
134
134
  },
135
135
  "peerDependencies": {
136
136
  "@playwright/test": ">=1.55.0",
@@ -729,6 +729,39 @@ function injectChildEnvironment(method, args) {
729
729
  });
730
730
  return next;
731
731
  }
732
+ // A signal a crash raises, never the SIGTERM or SIGKILL a suite's teardown
733
+ // sends. A child it ends says nothing: on 2026-11-06 a backend that died so
734
+ // right after it listened read as one that never became ready, and a
735
+ // Playwright worker as one that "exited unexpectedly".
736
+ const CRASH_SIGNALS = new Set(["SIGSEGV", "SIGBUS", "SIGILL", "SIGFPE", "SIGABRT", "SIGTRAP", "SIGSYS"]);
737
+ function noteCrash(signal, child, command, started) {
738
+ if (!CRASH_SIGNALS.has(signal))
739
+ return;
740
+ record({
741
+ event: "child-exit",
742
+ ...(typeof child === "number" ? { child } : {}),
743
+ signal,
744
+ command: safeArgument(String(command ?? "")),
745
+ ranMs: Date.now() - started,
746
+ });
747
+ }
748
+ function watchChild(method, args, run) {
749
+ const started = Date.now();
750
+ let launched;
751
+ try {
752
+ launched = run();
753
+ }
754
+ catch (error) {
755
+ // execSync and execFileSync throw for a child a signal ended.
756
+ noteCrash(error?.signal, error?.pid, args[0], started);
757
+ throw error;
758
+ }
759
+ if (method === "spawnSync")
760
+ noteCrash(launched?.signal, launched?.pid, args[0], started);
761
+ else if (typeof launched?.once === "function")
762
+ launched.once("exit", (_code, signal) => noteCrash(signal, launched.pid, args[0], started));
763
+ return launched;
764
+ }
732
765
  function patchChildProcesses() {
733
766
  const methods = [
734
767
  "spawn",
@@ -745,7 +778,7 @@ function patchChildProcesses() {
745
778
  configurable: true,
746
779
  enumerable: true,
747
780
  writable: true,
748
- value: keepPromisifiedShape(original, (...args) => Reflect.apply(original, childProcess, injectChildEnvironment(method, args))),
781
+ value: keepPromisifiedShape(original, (...args) => watchChild(method, args, () => Reflect.apply(original, childProcess, injectChildEnvironment(method, args)))),
749
782
  });
750
783
  }
751
784
  syncBuiltinESMExports();
@@ -13,6 +13,27 @@ import { fileURLToPath } from "node:url";
13
13
  import { installLaunchSupervisor, wrapImportedCapability } from "./launchSupervisor.mjs";
14
14
  import { __supercovBindCapabilityWrapper } from "./capability.mjs";
15
15
  installLaunchSupervisor();
16
+ // Playwright 1.59 writes each file it compiles into its cache in place and
17
+ // reads it back unchecked: a process that read one while another wrote it
18
+ // ran an empty module, and a config of no `default` failed at "Cannot add
19
+ // property metadata, object is not extensible". The cache a run gives it
20
+ // starts empty, so every run compiled; there each file is written whole, or
21
+ // is not there yet and is compiled again. A file written beside the cache's
22
+ // folders, not in one, is never taken for an old entry and removed.
23
+ const transformCache = process.env.PWTEST_CACHE_DIR;
24
+ if (transformCache) {
25
+ const cacheFolder = resolve(transformCache) + sep;
26
+ const writeFileSync = fs.writeFileSync;
27
+ let written = 0;
28
+ fs.writeFileSync = function (file, ...rest) {
29
+ if (typeof file !== "string" || !resolve(file).startsWith(cacheFolder))
30
+ return writeFileSync.call(this, file, ...rest);
31
+ const partial = resolve(transformCache, `.writing-${process.pid}-${written++}`);
32
+ writeFileSync.call(this, partial, ...rest);
33
+ fs.renameSync(partial, file);
34
+ };
35
+ syncBuiltinESMExports();
36
+ }
16
37
  // Instrumented sources import the browser-safe capability seam; bind the
17
38
  // real supervisor implementation before any user module evaluates.
18
39
  __supercovBindCapabilityWrapper(wrapImportedCapability);