@activate-core/test-forge 0.12.0 → 0.12.1
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/core/harness.js +21 -4
- package/package.json +1 -1
package/dist/core/harness.js
CHANGED
|
@@ -234,19 +234,36 @@ export function generateHarness(harnessPath, framework) {
|
|
|
234
234
|
}
|
|
235
235
|
/** Async twin, so a harness can generate alongside other work. */
|
|
236
236
|
export function generateHarnessAsync(harnessPath, framework) {
|
|
237
|
+
const config = loadConfig();
|
|
237
238
|
const prompt = buildHarnessPrompt(harnessPath, framework);
|
|
238
|
-
const { program, args } = withReadOnlyTools(splitCommand(
|
|
239
|
+
const { program, args } = withReadOnlyTools(splitCommand(config.aiCommand));
|
|
240
|
+
const timeoutMs = config.aiTimeoutMs ?? 300_000;
|
|
239
241
|
return new Promise((resolve, reject) => {
|
|
240
242
|
const child = spawn(program, args, { stdio: ['pipe', 'pipe', 'pipe'] });
|
|
241
243
|
let out = '';
|
|
242
244
|
let err = '';
|
|
245
|
+
let done = false;
|
|
246
|
+
const finish = (fn) => {
|
|
247
|
+
if (done)
|
|
248
|
+
return;
|
|
249
|
+
done = true;
|
|
250
|
+
clearTimeout(timer);
|
|
251
|
+
fn();
|
|
252
|
+
};
|
|
253
|
+
// Without this, a harness call that hangs (flaky network, a stalled AI
|
|
254
|
+
// CLI) never closes and the whole run wedges on step 1 forever — kill it
|
|
255
|
+
// and surface a resumable error so the caller can retry.
|
|
256
|
+
const timer = setTimeout(() => {
|
|
257
|
+
child.kill('SIGKILL');
|
|
258
|
+
finish(() => reject(new Error(`harness gen timed out after ${timeoutMs}ms — the AI CLI did not respond`)));
|
|
259
|
+
}, timeoutMs);
|
|
243
260
|
child.stdout.setEncoding('utf-8');
|
|
244
261
|
child.stdout.on('data', (d) => (out += d));
|
|
245
262
|
child.stderr.on('data', (d) => (err += d));
|
|
246
|
-
child.on('error', reject);
|
|
247
|
-
child.on('close', (code) => code === 0
|
|
263
|
+
child.on('error', (e) => finish(() => reject(e)));
|
|
264
|
+
child.on('close', (code) => finish(() => code === 0
|
|
248
265
|
? resolve(cleanOutput(out))
|
|
249
|
-
: reject(new Error(`harness gen exited ${code}: ${err.slice(0, 300)}`)));
|
|
266
|
+
: reject(new Error(`harness gen exited ${code}: ${err.slice(0, 300)}`))));
|
|
250
267
|
child.stdin.end(prompt);
|
|
251
268
|
});
|
|
252
269
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@activate-core/test-forge",
|
|
3
|
-
"version": "0.12.
|
|
3
|
+
"version": "0.12.1",
|
|
4
4
|
"description": "AI-powered QA automation. Scans a project, drafts journey docs, and generates seeded Jest/Playwright tests. Works in any project, with any AI CLI.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|