From 379cdd92764472e798474747463f6311b8f3ff64 Mon Sep 17 00:00:00 2001 From: Isaac Hill <71404865+isaachilly@users.noreply.github.com> Date: Mon, 3 Aug 2026 18:01:04 +0200 Subject: [PATCH] Reset test profile DB before each test run to fix alternating pass/fail `testdb.json` is used by the test server to persist user profiles, but it is never cleaned up between separate test runs (`npm run test`). `successfully save the profile of the user when pressed the "Save Profile" menu-item` test in `user-actions-mocha.js` toggles a column's visibility and saves it. Because the file isn't reset between runs, this modified state carries over to the next time the suite runs, causing the subsequent test, which relies on the visibility being what it originally was, to fail on that next run. --- InfoLogger/test/mocha-index.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/InfoLogger/test/mocha-index.js b/InfoLogger/test/mocha-index.js index aa2ab23b6..273b58edc 100644 --- a/InfoLogger/test/mocha-index.js +++ b/InfoLogger/test/mocha-index.js @@ -16,6 +16,7 @@ const puppeteer = require('puppeteer'); const assert = require('assert'); const { spawn } = require('child_process'); +const fs = require('fs'); const config = require('./test-config.js'); const { createServer, closeServer } = require('./live-simulator/infoLoggerServer.js'); @@ -58,6 +59,10 @@ describe('InfoLogger', function () { } }); + // Remove any leftover user profile DB from a previous run so tests that modify + // profile state (e.g. user-actions-mocha) always start from the same known state. + fs.rmSync(config.dbFile, { force: true }); + // Start infologger server simulator ilgServer = createServer();