From 1d1440883044a00db2c67d56564b00e3449bb357 Mon Sep 17 00:00:00 2001 From: DeNNiiInc Date: Sun, 28 Dec 2025 21:09:16 +1100 Subject: [PATCH] Fix(runner): Restore missing DB insert query in rollback --- lib/runner.js | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/lib/runner.js b/lib/runner.js index 884e707..0ed0f00 100644 --- a/lib/runner.js +++ b/lib/runner.js @@ -240,6 +240,28 @@ async function _executeTest(url, options) { const jsonPath = path.join(reportDir, `${testId}.json`); fs.writeFileSync(jsonPath, JSON.stringify(summary, null, 2)); + // Prepare Database Insert + const insertQuery = ` + INSERT INTO test_results ( + test_id, user_uuid, user_ip, url, is_mobile, + scores, metrics, filmstrip, summary, suite_id, run_number, timestamp + ) VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, NOW()) + RETURNING id + `; + + const values = [ + testId, + options.userUuid || null, + options.userIp || null, + lhr.finalUrl, + isMobile, + summary.scores, + summary.metrics, + filmstripData, + summary, + options.suiteId || null, + options.runNumber || 1 + ]; try { const db = require('../lib/db'); await db.pool.query(insertQuery, values);