supercov 4.24.2 → 4.24.4

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.4",
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.4",
127
+ "@supercov/cli-darwin-x64": "4.24.4",
128
+ "@supercov/cli-linux-arm64-gnu": "4.24.4",
129
+ "@supercov/cli-linux-arm64-musl": "4.24.4",
130
+ "@supercov/cli-linux-x64-gnu": "4.24.4",
131
+ "@supercov/cli-linux-x64-musl": "4.24.4",
132
+ "@supercov/cli-win32-arm64": "4.24.4",
133
+ "@supercov/cli-win32-x64": "4.24.4"
134
134
  },
135
135
  "peerDependencies": {
136
136
  "@playwright/test": ">=1.55.0",
@@ -314,7 +314,7 @@ function wrapResult(value, mapping) {
314
314
  // non-writable own data property (and `undefined` for a non-configurable
315
315
  // accessor without a getter). Constructors commonly expose `prototype` this
316
316
  // way. Returning another capability proxy is a TypeError before user code can
317
- // run, as seen with PrismaSessionStorage during an Essential Apps VM bake.
317
+ // run, as seen with PrismaSessionStorage during a VM bake.
318
318
  function fixedProxyValue(target, property) {
319
319
  const descriptor = Reflect.getOwnPropertyDescriptor(target, property);
320
320
  if (!descriptor || descriptor.configurable)
@@ -729,6 +729,49 @@ 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
+ // The command a child ran, its arguments too: `spawn("npm", ["run",
738
+ // "build"])` names its build only with them.
739
+ function commandLine(args) {
740
+ const words = Array.isArray(args[1]) ? args[1] : [];
741
+ return [args[0], ...words].map((word) => String(word ?? "")).join(" ");
742
+ }
743
+ // A child that a crash signal ended, or that exited non-zero: a build the
744
+ // command started from its own code, which the command's words do not
745
+ // name, is told apart from one it never ran by this.
746
+ function noteExit(signal, code, child, args, started) {
747
+ const crashed = CRASH_SIGNALS.has(signal);
748
+ if (!crashed && !(signal == null && typeof code === "number" && code !== 0))
749
+ return;
750
+ record({
751
+ event: "child-exit",
752
+ ...(typeof child === "number" ? { child } : {}),
753
+ ...(crashed ? { signal } : { code }),
754
+ command: safeArgument(commandLine(args)),
755
+ ranMs: Date.now() - started,
756
+ });
757
+ }
758
+ function watchChild(method, args, run) {
759
+ const started = Date.now();
760
+ let launched;
761
+ try {
762
+ launched = run();
763
+ }
764
+ catch (error) {
765
+ // execSync and execFileSync throw for a child that failed.
766
+ noteExit(error?.signal, error?.status, error?.pid, args, started);
767
+ throw error;
768
+ }
769
+ if (method === "spawnSync")
770
+ noteExit(launched?.signal, launched?.status, launched?.pid, args, started);
771
+ else if (typeof launched?.once === "function")
772
+ launched.once("exit", (code, signal) => noteExit(signal, code, launched.pid, args, started));
773
+ return launched;
774
+ }
732
775
  function patchChildProcesses() {
733
776
  const methods = [
734
777
  "spawn",
@@ -745,7 +788,7 @@ function patchChildProcesses() {
745
788
  configurable: true,
746
789
  enumerable: true,
747
790
  writable: true,
748
- value: keepPromisifiedShape(original, (...args) => Reflect.apply(original, childProcess, injectChildEnvironment(method, args))),
791
+ value: keepPromisifiedShape(original, (...args) => watchChild(method, args, () => Reflect.apply(original, childProcess, injectChildEnvironment(method, args)))),
749
792
  });
750
793
  }
751
794
  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);