@corbat-tech/coco 2.1.0 → 2.2.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/dist/index.js CHANGED
@@ -3941,6 +3941,17 @@ var DEFAULT_QUALITY_THRESHOLDS = {
3941
3941
  maxIterations: 10,
3942
3942
  minIterations: 2
3943
3943
  };
3944
+
3945
+ // src/utils/subprocess-registry.ts
3946
+ var activeSubprocesses = /* @__PURE__ */ new Set();
3947
+ function trackSubprocess(proc) {
3948
+ activeSubprocesses.add(proc);
3949
+ const cleanup = () => activeSubprocesses.delete(proc);
3950
+ proc.then(cleanup, cleanup);
3951
+ return proc;
3952
+ }
3953
+
3954
+ // src/quality/analyzers/coverage.ts
3944
3955
  async function detectTestFramework(projectPath) {
3945
3956
  try {
3946
3957
  const pkgPath = join(projectPath, "package.json");
@@ -4051,12 +4062,16 @@ var CoverageAnalyzer = class {
4051
4062
  }
4052
4063
  const commands = this.buildCoverageCommand(framework, coverageTool);
4053
4064
  try {
4054
- const result = await execa(commands.command, commands.args, {
4065
+ const proc = execa(commands.command, commands.args, {
4055
4066
  cwd: this.projectPath,
4056
4067
  reject: false,
4057
- timeout: 12e4
4068
+ timeout: 12e4,
4058
4069
  // 2 minutes
4070
+ cleanup: true
4071
+ // kill process tree on parent exit
4059
4072
  });
4073
+ trackSubprocess(proc);
4074
+ const result = await proc;
4060
4075
  if (result.exitCode !== 0 && !result.stdout.includes("coverage")) {
4061
4076
  throw new Error(`Tests failed: ${result.stderr || result.stdout}`);
4062
4077
  }
@@ -4993,12 +5008,16 @@ var CorrectnessAnalyzer = class {
4993
5008
  return { passed: 0, failed: 0, skipped: 0 };
4994
5009
  }
4995
5010
  try {
4996
- const result = await execa(cmd.command, cmd.args, {
5011
+ const proc = execa(cmd.command, cmd.args, {
4997
5012
  cwd: this.projectPath,
4998
5013
  reject: false,
4999
- timeout: 3e5
5014
+ timeout: 3e5,
5000
5015
  // 5 minutes
5016
+ cleanup: true
5017
+ // kill process tree on parent exit
5001
5018
  });
5019
+ trackSubprocess(proc);
5020
+ const result = await proc;
5002
5021
  const output = result.stdout + "\n" + result.stderr;
5003
5022
  switch (framework) {
5004
5023
  case "vitest":
@@ -15968,12 +15987,16 @@ Examples:
15968
15987
  tool: "run_tests"
15969
15988
  });
15970
15989
  }
15971
- const result = await execa(command, args, {
15990
+ const proc = execa(command, args, {
15972
15991
  cwd: projectDir,
15973
15992
  reject: false,
15974
- timeout: 3e5
15993
+ timeout: 3e5,
15975
15994
  // 5 minute timeout
15995
+ cleanup: true
15996
+ // kill process tree on parent exit
15976
15997
  });
15998
+ trackSubprocess(proc);
15999
+ const result = await proc;
15977
16000
  const duration = performance.now() - startTime;
15978
16001
  return parseTestResults(
15979
16002
  detectedFramework,